Error adding fields in the Fields Editor of TMyQuery

Discussion of open issues, suggestions and bugs regarding MyDAC (Data Access Components for MySQL) for Delphi, C++Builder, Lazarus (and FPC)
Post Reply
sctrojan79
Posts: 4
Joined: Fri 26 May 2006 21:55
Location: Los Angeles, CA

Error adding fields in the Fields Editor of TMyQuery

Post by sctrojan79 » Fri 09 Jun 2006 02:54

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

sctrojan79
Posts: 4
Joined: Fri 26 May 2006 21:55
Location: Los Angeles, CA

Post by sctrojan79 » Fri 09 Jun 2006 18:31

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.

Code: Select all

    object Productsshipping: TFloatField
      FieldName = 'shipping'
    end
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?

Antaeus
Posts: 2098
Joined: Tue 14 Feb 2006 10:14

Post by Antaeus » Tue 13 Jun 2006 11:56

Unfortunately we couldn't reproduce the problem. Please try to reproduce it in a new application and send us this application (evgeniyD*crlab*com) with detailed description of performed steps.

Post Reply