asp.net OleDbCommand 的用法
程序员文章站
2022-12-02 11:25:11
oledbconnection con=new oledbconnection("provider=microsoft.jet.oledb.4.0;&n...
oledbconnection con=new oledbconnection("provider=microsoft.jet.oledb.4.0; data source=data.mdb");
con.open();
oledbcommand dc=new oledbcommand("select name from us where id=2", con);
textbox1.text=dc.executescalar().tostring();
oledbconnection con=new oledbconnection("provider=microsoft.jet.oledb.4.0; data source=data.mdb");
con.open();
oledbcommand dc=new oledbcommand("insert into us (name) values (11)", con);
dc.executenonquery();
con.close();
string us=textbox2.text;
string pa=textbox1.text;
oledbconnection con=new oledbconnection("provider=microsoft.jet.oledb.4.0; data source=data.mdb");
oledbcommand oldc=new oledbcommand("insert into users (username, userpassword) values (@username, @userpassword)", con);
oldc.parameters.add("@username", us);
oldc.parameters.add("@userpassword", pa);
con.open();
oldc.executenonquery();
con.close();
messagebox.show("register successful!");
this.dispose();
con.open();
oledbcommand dc=new oledbcommand("select name from us where id=2", con);
textbox1.text=dc.executescalar().tostring();
oledbconnection con=new oledbconnection("provider=microsoft.jet.oledb.4.0; data source=data.mdb");
con.open();
oledbcommand dc=new oledbcommand("insert into us (name) values (11)", con);
dc.executenonquery();
con.close();
string us=textbox2.text;
string pa=textbox1.text;
oledbconnection con=new oledbconnection("provider=microsoft.jet.oledb.4.0; data source=data.mdb");
oledbcommand oldc=new oledbcommand("insert into users (username, userpassword) values (@username, @userpassword)", con);
oldc.parameters.add("@username", us);
oldc.parameters.add("@userpassword", pa);
con.open();
oldc.executenonquery();
con.close();
messagebox.show("register successful!");
this.dispose();