Delphi Pages Forums  

Go Back   Delphi Pages Forums > Delphi Forum > General

Lost Password?

Reply
 
Thread Tools Display Modes
  #1  
Old 07-04-2003, 11:57 PM
farhang farhang is offline
Junior Member
 
Join Date: Oct 2001
Posts: 19
Default AutoIncrement field SQL Update Problem!

When I update a MySQL table which has an AutoIncrement field, with the ClientDataset.ApplyUpdatees() command, Delphi gives the error ' ... field must have a value...'.

1. Is this the fault of MySQL or Delphi that do not resolve AutoIncrement field automatically?
2. How can I solve this problem?

Best regards.
Reply With Quote
  #2  
Old 07-05-2003, 02:44 AM
mshkolnik mshkolnik is offline
Senior Member
 
Join Date: Jul 2001
Posts: 4,195
Default RE: AutoIncrement field SQL Update Problem!

All what you need is to set the Required property for field in False.
Just open a field editor in Delphi, add fields from table to dataset, mark your autoinc-field and set Required=False

With best regards, Mike Shkolnik
http://www.scalabium.com
Reply With Quote
  #3  
Old 07-05-2003, 08:45 AM
jamiguel77 jamiguel77 is offline
Senior Member
 
Join Date: Jan 2002
Posts: 1,171
Send a message via MSN to jamiguel77 Send a message via Yahoo to jamiguel77
Default RE: AutoIncrement field SQL Update Problem!

uu need use sql statments:

by sample:

create table mytable (myid int primary key auto_increment, myfield1 varchar(20), myfiel2 decimal(10,2))

then u need use sql ann a Tquery or Zquery:


Query1.sql.text:='Insert into mytable (myfield1, myfield2) values ('''+edit1.text+''','+edit2.text')';

or
var
i:integer;

Query1.sql.text:='update mytable set myfield1='''+edit1.text+''', myfield2='+edit2.text+' where myid='+inttostr(i);


then u not need autoincrement the field ... catch the idea?

accept the answer if help you thanks
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is On

Forum Jump


All times are GMT. The time now is 01:27 PM.


Powered by vBulletin® Version 3.8.8
Copyright ©2000 - 2019, vBulletin Solutions, Inc.