string strconn="Provider=Microsoft.Jet.OleDb.4.0;Data Source="+Server.MapPath("data/data.mdb");
OleDbConnection objconn=new OleDbConnection(strconn);
string strsql="insert into user(username,password,firstflag) values(@username,@password,@firstflag)";
objconn.Open();
OleDbCommand objcom=new OleDbCommand();
objcom.Connection=objconn;
objcom.CommandText=strsql;
objcom.Parameters.Add("@username",OleDbType.VarChar,50);
objcom.Parameters["@username"].Value=this.TextBox7.Text;
objcom.Parameters.Add("@password",OleDbType.VarChar,50);
objcom.Parameters["@password"].Value=this.TextBox6.Text;
objcom.Parameters.Add("@firstflag",OleDbType.VarChar,1);
objcom.Parameters["@firstflag"].Value="1";
objcom.ExecuteNonQuery();
这是代码,和头开始没什么区别!!