无法更新并插入记录集 [英] Unable to update and insert to recordset

查看:125
本文介绍了无法更新并插入记录集的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在VS 2010中运行的VB.Net应用程序;我有一个数据集连接到SQL Server  DB。


我有一个表单,可以将数据加载到表单视图(不是gridview),没有任何问题,我可以正确读取和导航;


然而,当我尝试添加或更新一行时,我收到一条错误消息,上面写着:


ExecuteReader:CommandText属性尚未初始化

System.InvalidOperationException:ExecuteReader:CommandText属性尚未初始化

  在VCRS.dstVendorsTableAdapters.TableAdapterManager.UpdateAll(dstVendors dataSet)中的C:\ Holodeck \ Labs \Legislature \ VCRS \ VCRS \dstVendors.Designer.vb:第11253行$
   在VCRS.prg_VendorCompl_F.T_VendorComplBindingNavigatorSaveItem_Click(Object sender,EventArgs e)中的C:\ Holodeck \ Labs \ Legislature \ VCRS \ VCRS \ prg_VendorCompl_F.vb:第7行

解决方案



消息"ExecuteReader: CommandText属性尚未初始化"是一个常见的错误消息,此错误的最常见情况是您使用SQL语句或存储过程
名称错误地设置命令对象的commandText属性,也许您可​​以检查并调试SQL语句。


根据您的描述,有一个字段被定义为只读,当然,如果您在SQL语句中更改此字段,编译器将报告错误,尝试重新定义它。


希望它对您有所帮助。


最好的问候,


Bob




VB.Net application running in VS 2010; I have a dataset connected to an SQL Server DB.

I have a form that loads data into a form view (not a gridview), without any problems, I can read and navigate properly;

However, when I try add or update a row I am getting an error message that says:

ExecuteReader: CommandText property has not been initialized
System.InvalidOperationException: ExecuteReader: CommandText property has not been initialized
   at VCRS.dstVendorsTableAdapters.TableAdapterManager.UpdateAll(dstVendors dataSet) in C:\Holodeck\Labs\Legislature\VCRS\VCRS\dstVendors.Designer.vb:line 11253
   at VCRS.prg_VendorCompl_F.T_VendorComplBindingNavigatorSaveItem_Click(Object sender, EventArgs e) in C:\Holodeck\Labs\Legislature\VCRS\VCRS\prg_VendorCompl_F.vb:line 7

解决方案

Hi,

The message "ExecuteReader: CommandText property has not been initialized" is a common error message, the most common case of this error is that you set the commandText property of the command object with your SQL statement or stored procedure name incorrectly, maybe you can check and debug the SQL statement.

And from your description, there is a field is defined as readonly, of course the compiler will report an error if you change this field in your SQL statement, try to redefine it.

Hope it can be helpful to you.

Best Regards,

Bob


这篇关于无法更新并插入记录集的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆