If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Database Server Software > MySQL > get a value of an autoincrement by adotable

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 11-18-04, 07:52
MJP2004 MJP2004 is offline
Registered User
 
Join Date: Nov 2004
Posts: 1
get a value of an autoincrement by adotable

I need to get a value of an autoincrement after its posted. I'm obtaining a Null value instead the inserted ID in the field Result. It's URGENT!!!!!

This is my code:
------------------------

function TMySQL4.CreateRecord(conn: TCustomConnection; table: string;
Values, Fields, ResultFields:array of string;Results : array of POleVariant ): HRESULT;

var
adoTable: TADOTable;
i:integer;

begin
result := E_FAIL;

adoTable:=nil;

try
adoTable := TADOTable.Create(nil);
adoTable.Connection := TADOConnection(conn);
adoTable.TableName := table;
adoTable.Active:=true;

if adoTable.State in [dsBrowse] then
begin
adoTable.Append;
for i:=0 to High(Fields) do
begin
adoTable.FieldValues[Fields[i]] := Values[i];
end;

adoTable.Post;

for i:=0 to High(Results) do
begin
Results[i]^ := adoTable.FieldValues[ResultFields[i]];
end;
result := E_OK;
end
end;
----------------------

Thanks a lot!
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
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 Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On