Access2007数据库下载地址与AccessHelper
程序员文章站
2022-04-08 19:16:12
链接:https://pan.baidu.com/s/1pLzOlTv0nqSbhzujHZht1w 提取码:1m9l AccessHelper: //Microsoft.ACE.OLEDB.12.0是连接access2007之后的数据库使用的 //Microsoft.Jet.OLEDB.4.0是连 ......
链接:https://pan.baidu.com/s/1plzoltv0nqsbhzujhzht1w
提取码:1m9l
accesshelper:
using system; using system.collections.generic; using system.data; using system.data.oledb; using system.linq; using system.text; namespace accessireaderdemo { public class accesshelper { string str = @"provider=microsoft.jet.oledb.4.0; data source=f:\邯钢工作计划\物理站\华龙冲击\cbddata2018.mdb"; private static string str; public accesshelper(string _connstr) { str = _connstr; } public static dataset excedataset(string sql, oledbparameter[] parm = null, commandtype type = commandtype.text) { using (oledbconnection conn = new oledbconnection(str)) { using (oledbcommand cmd = new oledbcommand(sql, conn)) { if (parm != null) cmd.parameters.addrange(parm); oledbdataadapter abs = new oledbdataadapter(cmd); dataset set = new dataset(); conn.open(); abs.fill(set); return set; } } } /// <summary> /// reader /// </summary> /// <param name="sql"></param> /// <param name="parm"></param> /// <param name="type"></param> /// <returns></returns> public static oledbdatareader reader(string sql, oledbparameter[] parm = null, commandtype type = commandtype.text) { oledbconnection conn = new oledbconnection(str); oledbcommand cmd = new oledbcommand(sql, conn); if (parm != null) cmd.parameters.addrange(parm); conn.open(); oledbdatareader reader = null; try { reader = cmd.executereader(commandbehavior.closeconnection); } catch (exception e) { throw; } return reader; } /// <summary> /// 查询首行首列 /// </summary> /// <param name="sql"></param> /// <param name="parm"></param> /// <param name="type"></param> /// <returns></returns> public static object excescale(string sql, oledbparameter[] parm = null, commandtype type = commandtype.text) { using (oledbconnection conn = new oledbconnection(str)) { using (oledbcommand cmd = new oledbcommand(sql, conn)) { if (parm != null) cmd.parameters.addrange(parm); cmd.commandtype = type; conn.open(); return cmd.executescalar(); } } } /// <summary> /// 几行受影响 /// </summary> /// <param name="sql"></param> /// <param name="parm"></param> /// <param name="type"></param> /// <returns></returns> public static int excequery(string sql, oledbparameter[] parm = null, commandtype type = commandtype.text) { using (oledbconnection conn = new oledbconnection(str)) { using (oledbcommand cmd = new oledbcommand(sql, conn)) { if (parm != null) cmd.parameters.addrange(parm); cmd.commandtype = type; conn.open(); return cmd.executenonquery(); } } } } }
//microsoft.ace.oledb.12.0是连接access2007之后的数据库使用的
//microsoft.jet.oledb.4.0是连接access2003等数据库使用的。
推荐阅读
-
oracle与mysql的视频教程下载地址分享
-
Windows 8.1 with Update MSDN简体/繁体中文原版下载地址与安装密匙
-
怎么区分WinRAR 5.50无广告版与有广告版?两者对比介绍(附下载地址)
-
微力同步Linux版怎么使用?微力同步Linux版使用详细教程与下载地址
-
Access2007数据库下载地址与AccessHelper
-
Win10创意者更新15063.786正式版累积补丁KB4053580推送(附更新内容与下载地址)
-
Win10 UWP版《微信》v1.1正式版更新主要修复Bug、优化与下载地址:群聊中可以@ 人
-
Oracle数据库下载与安装的完整步骤
-
Microsoft SQL Server数据库各版本下载地址集合
-
文件上传与下载之数据库实现