Thread View: borland.public.delphi.database.win32
2 messages
2 total messages
Started by Joerg Schiffmann
Mon, 26 May 2008 10:37
Autoincrment BF FIeld and ClientDataSet
Author: Joerg Schiffmann
Date: Mon, 26 May 2008 10:37
Date: Mon, 26 May 2008 10:37
45 lines
2499 bytes
2499 bytes
Hi,
we have some trouble with a BlackFish db, autoincrement fields and clientdataset:
To create a autoincrment col with dataexplorer create a new table.
First col Name 'ID' and set type to INTEGER AUTOINCREMENT.
Second col 'Name' Varchar
OK! That works fine and BF does, what to do.
All SQL statements works too...
But we have a win32 (IW=VCL for the web) client server application with a dbx connection, sql DataSet and provider and ClientDataset (united within SimpleDataSet)
"SampleDtaSet" with 'ID' and 'NAME' cols for instance. The
query is 'Select * from new'
Now I want to append (or insert) a record to the (first) ClientDataset:
(C++ syntax)
SampleDtaSet->Append();
SampleDtaSet->FieldByName("NAME")->AsString = "Joerg";
SampleDtaSet->Post();
Now app failed with "exception 'ID' is empty"! We tried to set the field property 'Required' to 'false' for 'ID' but not success.
If we test a number like
SampleDtaSet->FieldByName("ID")->AsInteger = 5;
after
SampleDtaSet->ApplyUpdates(0);
the ID field is set by the AUTOINCREMENT mechanism.
But what happens, if '5' is present before->Exception and s.o.
Why or how have I to set the ID before post the ClientDataset?
For me a problem like 'cat hunts the tail'
We would like to know the value of an autoincrement-column of a
BlackfishSQL-DB before the insert-statement is executed. The reason: The column is required and that's why we are getting the exception "Column-Value required" (post of clientdataset!)
That's my Question
with
regards
Joerg
Re: Autoincrment BF FIeld and ClientDataSet
Author: Bill Todd [TeamB]
Date: Mon, 26 May 2008 12:36
Date: Mon, 26 May 2008 12:36
5 lines
968 bytes
968 bytes
Replace TSimpleDataSet with separate components. Set the Required property to false on the TSQLDataSet and the TClientDataSet. -- Bill Todd (TeamB)
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads