狼局长十八摸,周一上班的熊样gif,叶晓丽
链接: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等数据库使用的。
如对本文有疑问,请在下面进行留言讨论,广大热心网友会与你互动!! 点击进行留言回复
Blazor server side 自家的一些开源的, 实用型项目的进度之 CEF客户端
.NET IoC模式依赖反转(DIP)、控制反转(Ioc)、依赖注入(DI)
vue+.netcore可支持业务代码扩展的开发框架 VOL.Vue 2.0版本发布
网友评论