System.Data.OleDb.OleDbException 操作必须使用一个可更新的查

1、ASP.NET网站出现以下错误,并且出错的页面有个修改点击率的更新数据库操作(程序没有代码错误):

string strSql="UPDATE reference SET hit=hit+1 WHERE id="+i;


2、错误提示如下:

System.Data.OleDb.OleDbException: 操作必须使用一个可更新的查询。 at
System.Data.OleDb.OleDbCommand.ExecuteCommandTextErrorHandling(OleDbHResult hr) at
System.Data.OleDb.OleDbCommand.ExecuteCommandTextForSingleResult(tagDBPARAMS dbParams, Object&
executeResult) at System.Data.OleDb.OleDbCommand.ExecuteCommandText(Object& executeResult) at
System.Data.OleDb.OleDbCommand.ExecuteCommand(CommandBehavior behavior, Object& executeResult) at
System.Data.OleDb.OleDbCommand.ExecuteReaderInternal(CommandBehavior behavior, String method) at
System.Data.OleDb.OleDbCommand.ExecuteNonQuery() at DDRS.FaqDetail.UpdateHit(Int32 i) in
d:/wwwroot/LG_vrd/FaqDetail.aspx.cs:line 64


3、故障原因:数据库没有给足相应权限
4、解决办法:开放读写权限,如下图所示
A、开放权限前:

B、开放权限后:

发表评论

您的邮箱地址不会被公开。