您好,欢迎访问一九零五行业门户网

编写sqlhelper类示例

自己编写sqlhelper,大家参考使用吧
using system; using system.collections.generic; using system.linq; using system.text; using system.windows; using system.windows.controls; using system.windows.data; using system.windows.documents; using system.windows.input; using system.windows.media; using system.windows.media.imaging; using system.windows.navigation; using system.windows.shapes; using system.data; using system.data.sqlclient; namespace sqlhelper { /// <summary> /// window1.xaml 的交互逻辑 /// </summary> public partial class window1 : window { public window1() { initializecomponent(); } //只用来执行查询结果比较少的sql private void btnds_click(object sender, routedeventargs e) { sqlhelper.executenonqurey("insert into t_student(name,age) values('张三',55)", new sqlparameter[0]); messagebox.show("添加成功"); } private void btndataset_click(object sender, routedeventargs e) { dataset ds= sqlhelper.executedataset("select * from t_student where hobbit='@hobbit'", new sqlparameter[]{new sqlparameter("'@hobbit'","哈哈哈")}); foreach(datarow row in ds.tables[0].rows) { string name = (string)row["name"]; messagebox.show(name); } } } }
更多编写sqlhelper类示例。
其它类似信息

推荐信息