0

I have Website which works fine on localhost but not on server when uploaded, it is giving an error as Operation must use a updatable query

Code is as follows:

    OleDbConnection myCon;

    string path = @Server.MapPath(".") + "/Accomdation1.mdb";
    myCon = new OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + path);

    myCon.Open();
    string f = TextBox1.Text;
    string g = TextBox5.Text;
    string d = DropDownList1.Text;
    string a = TextBox2.Text;
    string h = TextBox7.Text;
    string k = TextBox6.Text;
    string u = TextBox8.Text;
    string y = TextBox9.Text;

    OleDbCommand cmd = new OleDbCommand("INSERT INTO Accomdation (lastname, firstname,gender,UHCLID,Dateofarrival,timeofarrival,flightno,emaildi)" + " VALUES('" + f + "', '" + g + "', '" + d + "', '" + a + "', '" + h + "', '" + k + "', '" + u + "', '" + y + "')", myCon);
    cmd.ExecuteNonQuery();           
    // TextBox1.Text = e1.Message;     
    myCon.Close();
4

1 回答 1

0

TYR以下!1. 确保在尝试执行上述代码时没有打开“Accomdation1.mdb”。2. 右键单击​​“Accomdation1.mdb”下的 App_folder 转到“安全”选项卡下的属性,授予“网络服务”的完全权限

于 2012-06-28T02:58:11.583 回答