[DUG] MSSQL ID field binary(8)
John Bird
johnkbird at paradise.net.nz
Mon Aug 2 01:34:31 NZST 2010
Dealing with a MSSQL database where the ID field is defined as Binary ( 8 ) and using D2007 / ADO. I can open the table and read in data, but I cannot figure out:
1 - how to get the ID value out of this field - when displayed a grid shows this column as (BYTES), if I try to get the value as a variant then as a string I get an empty string
TheCompanyID_I_Want:=TABLE1.FieldByName('COMPANY_ID').asXXXXXDataType;
ie what datatype XXXXXDataType do I need to use to get the value ??
The best light I could shed on it with Google was a hint that this type might arrive as an array of Bytes - in which case how to process that?
2 - All I want to do with this value is to put in into a subsequent SQL statement on another table to do a further select of all records with this ID....
qryTable2.SQL.Text := 'SELECT * FROM TABLE2 WHERE COMPANY_ID = '+XXXXXDataTypeToString(TheCompanyID_I_Want);
Sorry for asking what is probably a dumb question, but its late at night and I am stuck. And as Einstein said "He who asks a question is a fool for a moment - he who doesn't ask a question is a fool forever"
John
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://listserver.123.net.nz/pipermail/delphi/attachments/20100802/6e80183b/attachment.html
More information about the Delphi
mailing list