命令文本属性尚未初始化 [英] Command Text Property has not been initoali

查看:87
本文介绍了命令文本属性尚未初始化的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述












我正在使用VB2008 Express版。


 当我添加时一个新的记录,保存所有的井。但是,当我编辑记录并尝试保存它时,我得到了 消息"命令文本属性尚未初始化。 代码行"COATableAdapter(KWBDataSet.COA)"突出显示。 当
我尝试重新打开数据文件时,所有记录都丢失了。 

解决方案

使用IDE数据向导生成TableAdapter,该向导负责创建添加命令,编辑,删除和检索数据。如果没有主键,则不会生成编辑命令,所以我的问题是,您是否为相关表定义了主键


关于添加记录并且在应用程序的下一次运行时,那些记录不存在是因为默认情况下通过.xsd文件生成TableAdapter时,项目的每个构建的默认行为是覆盖
中的数据库副本。 \ debug文件夹。有关详细信息,请参阅我的
代码示例
和Microsoft的文档
如何管理项目中的本地数据文件


I am using VB2008 Express edition.

 When I add a new record and save it all goes wells. However, when I edit a record and try to save it I get  the message "Command Text Property has not been Initialized. The code line "COATableAdapter(KWBDataSet.COA)" is highlighted. When I try to reopen the data file all of the records are missing. 



解决方案

A TableAdapter is generated using the IDE data wizard which is responsible for creating the commands for add, edit, remove and retrieve data. No edit command is generated when there is no primary key so my question to you is, have you defined a primary key for the table in question?

In regards to adding records and on the next run of the app those records are not there is because by default when generating the TableAdapter via the .xsd file the default behavior on each build of the project is to overwrite the copy of the database in the Bin\debug folder. For more details see my code sample and Microsoft's documentation How to Manage Local Data Files in Your Project.


这篇关于命令文本属性尚未初始化的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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