string sql="insert into message values('"+1199+"')";
string strcon="Provider=Microsoft.Jet.OLEDB.4.0;Data Source="+Server.MapPath("message.mdb")+";User Id=admin;Password=;";
OleDbConnection con=new OleDbConnection(strcon);
con.Open();
OleDbCommand mycmd=new OleDbCommand(sql,con);
mycmd.ExecuteNonQuery();
erro:
Operation must use an updateable query. 
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. Exception Details: System.Data.OleDb.OleDbException: Operation must use an updateable query.Source Error: 
Line 69:  con.Open();
Line 70:  OleDbCommand mycmd=new OleDbCommand(sql,con);
Line 71:  mycmd.ExecuteNonQuery();
Line 72: 
Line 73: 
 

解决方案 »

  1.   

    你的message表只有一个字段吗?如果是的话那我就不知道怎么错了~
    如果不是你要修改成:
    insert into message(对应字段名) values('"+1199+"')";
      

  2.   

    insert into message(对应字段名) values('1199')";
      

  3.   

    string sql="insert into message(message) values('"+this.TextBox1.Text.ToString()+"')";
    string strcon="Provider=Microsoft.Jet.OLEDB.4.0;Data Source="+Server.MapPath("message.mdb")+";User Id=admin;Password=;";
    OleDbConnection con=new OleDbConnection(strcon);
    con.Open();
    OleDbCommand mycmd=new OleDbCommand(sql,con);
    mycmd.ExecuteNonQuery();
    还是出现同样的错误