我的网站在localhost上运行正常但在上传时没有在服务器上工作,因为操作必须使用可更新的查询,所以它会出错。
代码如下:
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();
答案 0 :(得分:0)