I'm getting several errors when I try to add a new field ("newfield") to an existing TMyQuery ("mydataset") using the Fields Editor. This has happened to a few of the TMyQuery objects in my project - some work fine, others don't.
When I try to add newfield to the field list, I get the error "mydataset: Duplicate fieldname 'newfield'", even though there are no other fields named "newfield" After that, when I delete newfield from the Fields editor, newfield is removed from the list, but I then immediately get the error "Dataset: Field name missing". Meanwhile, I noticed in the header file the newfield TField declaration now contains a number after it (TFloatField mydatasetnewfield, mydatasetnewfield2, mydatasetnewfield3, and incrementing each time I remove then add the field - this does not happen with datasets that don't experience this error.)
If I try to build my project after getting this error, I get a linker error:
[Linker Fatal Error] RLINK32: Error opening file "C:\PROGRAM FILES\BORLAND\CBUILDER6\PROJECTS\MESSAGE MANAGER\ORDER_FRAME.DFM"
If I try to save the unit, I get the "mydataset: Field name missing" error again. (if I don't remove the field, I get the same linker error, and the error "mydataset: Duplicate fieldname 'newfield'" again).
If I don't add the field via the Fields Editor, attempting to access via the FieldByName("newfield") method instead, I get the EDataBaseError "mydataset: field 'newfield' not found".
Attempting to delete mydataset in the IDE causes the errors "Access violation at address 4000592A in module 'rtl60.bpl'. Read of address 000002B0.", and "Access violation at address 0589F4CA in module 'dac60.bpl'. Read of address 0000003C." - these errors continually reappear until I kill the CBuilder process.
Therefore, the only way I can get around this error is to create an entirely new unit with a new TMyQuery object, then cut and paste the SQL from the old to the new TMyQuery's, and copy over all the code from the old unit.
My Version info
Windows XP SP2
C++ Builder 6.0 (Build 10.166)
MyDAC 4.30.1.15
Error adding fields in the Fields Editor of TMyQuery
-
sctrojan79
- Posts: 4
- Joined: Fri 26 May 2006 21:55
- Location: Los Angeles, CA
-
sctrojan79
- Posts: 4
- Joined: Fri 26 May 2006 21:55
- Location: Los Angeles, CA
After digging around in the files for the unit I was working with, I was able to manually add the new field in the .dfm file, i.e.
Once I did this, I was able to access the fields in the dataset without problem. However, I still get the errors mentioned in my previous post when I try to add/remove fields in the IDE via the Fields Editor. Perhaps there is an error in the way the .dfm file is written when one makes changes to a TMyQuery?
Code: Select all
object Productsshipping: TFloatField
FieldName = 'shipping'
end