[CODE] string strconn="Provider=Microsoft.Jet.OleDb.4.0;Data Source="+Server.MapPath("data/data.mdb");
OleDbConnection objconn = new OleDbConnection(strconn);
try
{
string strsql = "insert into [user](username,password,firstflag) values(@username,@password,@password)";
objconn.Open();
OleDbCommand objcom = new OleDbCommand(strsql,objconn);
objcom.Parameters.Add("@username",OleDbType.VarChar,50);
objcom.Parameters["@username"].Value = "2";
objcom.Parameters.Add("@password",OleDbType.VarChar,50);
objcom.Parameters["@password"].Value = "3";
objcom.Parameters.Add("@firstflag",OleDbType.VarChar,1);
objcom.Parameters["@firstflag"].Value = "1";
objcom.ExecuteNonQuery();
}
catch(Exception exp)
{
Response.Write(exp.ToString());
}
finally
{
objconn.Close();
}[/CODE]
试试这样呢?
[此贴子已经被作者于2006-12-7 14:47:25编辑过]