简体   繁体   中英

Website works on localhost but not When uploaded to server it is giving an error

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();

tyr the followings! 1. make sure you are not opening "Accomdation1.mdb" while trying to execute the above code. 2. right click App_folder under "Accomdation1.mdb" go to properties under the securiety tab give full permission to "NETWORK SERVICE"

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM