BorlandTalk.com Forum Index BorlandTalk.com
Borland discussion newsgroups
 
Archives   FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Primary Key value

 
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> Delphi Databases (ADO)
View previous topic :: View next topic  
Author Message
George Kuascha
Guest





PostPosted: Sun Feb 20, 2005 4:14 pm    Post subject: Primary Key value Reply with quote



I'm using D6 with MS Access2000. I'm copying field data from ADOTable2 to
ADOTable1 one record at a time. After each record is copied, I need to
capture the primary key (named ID) value in a variable (FindID). After
posting the record to ADOTable1, the primary key value returned in my code
is zero. I've also tried opening and closing the table between records and
that doesn't help. Can anyone enlighted me on what I'm missing here?

with ADOTable1 do
begin
Insert;
FieldByName('Name1').Value:= ADOTable2.FieldValues['Name1'];
........
Post;
end;
FindID:= ADOTable1.FieldByName('ID').AsInteger;
showmessage(inttostr(FindID));


Back to top
George Kuascha
Guest





PostPosted: Sun Feb 20, 2005 10:55 pm    Post subject: Re: Primary Key value Reply with quote



I found my problem. I had a missing filter.

"George Kuascha" <gkhokie (AT) hotmail (DOT) com> wrote

Quote:
I'm using D6 with MS Access2000. I'm copying field data from ADOTable2 to
ADOTable1 one record at a time. After each record is copied, I need to
capture the primary key (named ID) value in a variable (FindID). After
posting the record to ADOTable1, the primary key value returned in my code
is zero. I've also tried opening and closing the table between records and
that doesn't help. Can anyone enlighted me on what I'm missing here?

with ADOTable1 do
begin
Insert;
FieldByName('Name1').Value:= ADOTable2.FieldValues['Name1'];
.......
Post;
end;
FindID:= ADOTable1.FieldByName('ID').AsInteger;
showmessage(inttostr(FindID));





Back to top
Display posts from previous:   
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> Delphi Databases (ADO) All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2006 phpBB Group
SEO toolkit © 2004-2006 webmedic.