“无效的字段类型” TClientDataSets 错误我不明白
我将嵌套数据库结构与 TClientDataSets 一起使用。 我是编程新手,所以我的行话有十比一的错误。
我的问题如下:我定义了我的数据库结构和嵌套结构的所有字段,然后调用主 clientDataSet 的 CreatDataSet 方法,它起作用了。 然后我想向主 ClientDataSet 添加另一个数据字段。 然后,我调用了 Master ClientDataSet 的 ClearData 方法,然后尝试再次调用 CreateDataSet 来创建新结构。 正是在这里我遇到了我的问题。 我收到“无效字段类型错误”,但我真的不知道或不明白问题是什么。
那么,在调用 createdata set 方法,然后调用cleardata 方法,然后添加一个字段,然后再次调用 createdataset 方法后,如何创建 exsta 字段而不会出现“无效字段类型”错误?
有谁有关于这个问题的任何信息吗? 我使用 Delphi 2007
Kind Rgards
Riaan de Villiers
I use nested database stuctures with TClientDataSets. I'm new to programming so my lingo is ten-to-one wrong.
My problem is as follows: I defined my database stucture and all the fields of the nested stuctures and then I called the CreatDataSet method of the master clientDataSet and it worked. I then wanted to add another data field to the master ClientDataSet. I then called the ClearData method of the Master ClientDataSet and then tried to create the new stucture by calling CreateDataSet again. It is here where I encounter my problem. I get the 'Invalid field type error' and I don't really know or understand what what the problem is.
So how do I create an exsta field after I called the createdata set method, then called the cleardata method, then added a field and then calling the createdataset method again without getting the 'invalid field type error?
Does anybody have any information about this problem. I use Delphi 2007
Kind Rgards
Riaan de Villiers
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
这是一个德尔福错误。
在调用 CreateDataSet 之前调用 YourDataset.FieldDefs.Clear ,它应该可以工作。
有关更多信息,请查看此质量控制报告:
http://qc.codegear。 com/wc/qcmain.aspx?d=38984
编辑:
仔细阅读您的问题后,问题可能是其他问题,但请尝试 FieldDefs.Clear 并让我知道结果。
It is a Delphi bug.
Call YourDataset.FieldDefs.Clear before calling CreateDataSet and it should work.
For more infomation please look at this QC Report:
http://qc.codegear.com/wc/qcmain.aspx?d=38984
EDIT:
After reading your problem more carefully, the problem might be something else, but please try the FieldDefs.Clear and let me know the results.
自从你问这个问题以来已经很长时间了,但我相信这个问题与嵌套数据集字段特别有关。 我以前见过这个错误,我相信它与创建特定字段的顺序有关。 如果我没记错的话,如果您尝试在定义或创建嵌套数据集字段之前创建主数据集,则会收到此无效字段类型错误。
首先从方程中删除嵌套数据集字段,看看问题是否仍然存在。 如果没有,则将它们添加回来。 尝试以不同的顺序创建主数据集及其嵌套数据集。
我知道这已经晚了,但我希望它有所帮助。
It has been a long time since you asked this question, but I believe the problem has specifically to do with the nested dataset fields. I've seen this error before, and I believe that it has to do with the order in which the particular fields are created. If I remember correctly, if you try to create the master dataset before the nested dataset fields are defined or created, you get this invalid field type error.
Begin by removing your nested dataset fields from the equation and see if you still get the problem. If not, then add them back. Try creating the master dataset and its nested datasets in different orders.
I know this is late, but I hope it helps.