Board index » delphi » mysql + auto_increment

mysql + auto_increment

Hi,

i have a table with an auto_increment id field (not null), not that unusual.

Using Delphi 6 Update 1 with dbexpress (mysql-driver) and objetcs TSQLQuery
/ TDataProvider / Clientdataset / Datasource (and bound editfields)
everything works, only inserting a new record produces an error:
"Field (id) must not be empty." (or similar)
I thought a field with auto_increment automatically fill an unique id-value.

Via ADO and myODBC it works as expected (but other problems). Is this
behaviour in dbexpress a bug? How can i workaround it? May i missed
something? Any ideas from Borland?

best regards
Thomas Kaltschmidt

 

Re:mysql + auto_increment


Only i have this problem??? No ideas?

Am 07.11.2001 18:39 Uhr schrieb "Thomas Kaltschmidt" unter
<tkaltschm...@t-online.de> in B80F3047.3D59%tkaltschm...@t-online.de:

Quote
> Hi,

> i have a table with an auto_increment id field (not null), not that unusual.

> Using Delphi 6 Update 1 with dbexpress (mysql-driver) and objetcs TSQLQuery
> / TDataProvider / Clientdataset / Datasource (and bound editfields)
> everything works, only inserting a new record produces an error:
> "Field (id) must not be empty." (or similar)
> I thought a field with auto_increment automatically fill an unique id-value.

> Via ADO and myODBC it works as expected (but other problems). Is this
> behaviour in dbexpress a bug? How can i workaround it? May i missed
> something? Any ideas from Borland?

> best regards
> Thomas Kaltschmidt

Re:mysql + auto_increment


Solved the problem for myself. A fairly simple one. For id-fields in Delphi
(auto_increment in mySQL) the property "required" must not be true. Delphi
turned that on automatically, and since im just starting using it and the
options are not that few, it took me some time.

Thomas

Am 08.11.2001 10:42 Uhr schrieb "Thomas Kaltschmidt" unter
<tkaltschm...@t-online.de> in B8101230.3E70%tkaltschm...@t-online.de:

Quote
> Only i have this problem??? No ideas?

> Am 07.11.2001 18:39 Uhr schrieb "Thomas Kaltschmidt" unter
> <tkaltschm...@t-online.de> in B80F3047.3D59%tkaltschm...@t-online.de:

>> Hi,

>> i have a table with an auto_increment id field (not null), not that unusual.

>> Using Delphi 6 Update 1 with dbexpress (mysql-driver) and objetcs TSQLQuery
>> / TDataProvider / Clientdataset / Datasource (and bound editfields)
>> everything works, only inserting a new record produces an error:
>> "Field (id) must not be empty." (or similar)
>> I thought a field with auto_increment automatically fill an unique id-value.

>> Via ADO and myODBC it works as expected (but other problems). Is this
>> behaviour in dbexpress a bug? How can i workaround it? May i missed
>> something? Any ideas from Borland?

>> best regards
>> Thomas Kaltschmidt

Other Threads