在已部署项目中插入,更新数据库中的数据时出现问题 [英] Problem in Inserting, updating data in database with deployed project
问题描述
我在以下方法中使用了用于检索,插入,更新和删除的代码
I used the code for Retrieving, Inserting, Updating and Deleting in following method
protected void Button1_Click(object sender, EventArgs e)
{
string conn = "ConnectionString";
SqlConnection sqlcon = new SqlConnection(conn);
sqlcon.Open();
SqlCommand comm = new SqlCommand("Insert into table1 (field1,field2) values (@f1,@f2)", sqlcon); //and retrieve, update,delete
comm.Parameters.AddWithValue("f1", int.Parse(txtid.Text.ToString()));
comm.Parameters.AddWithValue("f2", Txtname.Text.ToString());
comm.ExecuteNonQuery();
}
它在我的开发系统中运行良好,即Visual Studio已安装系统...
(我正在开发Windows应用程序,),(通过部署过程创建了安装文件)
但是当我通过创建的安装程序将此项目安装到另一个系统中时,
它能够从数据库中检索数据,但不能插入,更新,删除
我收到以下错误,
It is running good in my development system i.e. Visual Studio Installed System...
(I am Developing windows application,,,)(Created setup file by deployment process)
but when i install this project into another system by setup created,
It is able to retrieve the data from database but not inserting, updating , deleting
I am getting the following error,
Unhandled exception had occured in your application. If you click Continue, the application will ignore this error and attempt to continue. If you click Quit the application will close immediately.
Operation must use an Updatable Query.
我搜索了以上错误....
我找到了将数据库属性检查为只读"的解决方案.
但是它没有设置为只读
请给我一些解决方案
I searched for the above error....
I found solution that to check the database property is set to Read Only..
But it is not set to Read Only
plz give me some solution
推荐答案
一件事是检查数据库文件(和目录)是否可写,并且SQL Server使用的帐户有权写入它们.
One thing is to check that the database files (and the directory) are writable and account used by SQL Server has permissions to write to them.
这篇关于在已部署项目中插入,更新数据库中的数据时出现问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!