简体   繁体   English

网站可以在localhost上运行,但不能在上载到服务器时出现错误

[英]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 我的网站可以在localhost上正常运行,但在上传时不能在服务器上正常运行,它报错,因为操作必须使用可更新的查询

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. 1.确保在尝试执行上述代码时未打开“ Accomdation1.mdb”。 2. right click App_folder under "Accomdation1.mdb" go to properties under the securiety tab give full permission to "NETWORK SERVICE" 2.右键单击“ Accomdation1.mdb”下的App_folder,转到“安全性”选项卡下的属性,授予“网络服务”完全权限

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 RestSharp可在localhost上运行,但在上载到主机时返回错误 - RestSharp works on localhost, but returns an error when uploaded to host GridView:在服务器上运行时数据库错误,在本地主机上运行正常 - GridView: Database error when running on server, works fine on localhost 上载到服务器时出现APN错误 - APN Error when uploaded to Server 我对联系表有疑问。 在本地主机上工作。 当尝试通过提交按钮发布它时部署它的错误 - I have an issue with a contact form. Works on localhost. When deployed its giving error when attempting to post it via the submit button Google登录适用于localhost和测试服务器,但不适用于azure网站(应用服务) - Google login works on localhost and test server, but not azure website (app service) 上载到主网站服务器时无法获取服务参考 - Unable to get service reference when uploaded to main website server 我在iis中托管网站时出现错误500 ServerManager - Giving error 500 ServerManager when i host website in iis 发送电子邮件在localhost中有效但在托管网站中无效(GoDaddy) - Sending email works in localhost but not in hosted website(GoDaddy) 电子邮件最终会成为垃圾邮件,但仅当从实时网站发送时才如此。 Localhost作品 - Email ends up in spam but only when sending from live website. Localhost works .Replace(Environment.NewLine,“ <br /> “)在localhost上工作,但在我将网站上传到主机时则不行 - .Replace(Environment.NewLine, “<br />”) works on localhost but not when I upload my website to host
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM