OleDbCommand用法 asp.net OleDbCommand 的用法
人气:0想了解asp.net OleDbCommand 的用法的相关内容吗,在本文为您仔细讲解OleDbCommand用法的相关知识和一些Code实例,欢迎阅读和指正,我们先划重点:asp.net,OleDbCommand,下面大家一起来学习吧。
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();
加载全部内容