I work with Delphi 2005 and the current dbExpress Drivers from Corelab. When I try to use the function below, then I get as result an exception. But when I just use the dbExpress-Drivers from Borland, then it works really nice.
I connect to a SQL 2000 Server and the result of the query is a sql_variant. The result should be something like 30000. I tried to get the result by Fields[0].AsString, but then it is 0.00003000.
Code: Select all
function Tultratlistbox.ExtractedMethod : Variant;
var
ASQLQuery: TSQLQuery;
begin
ASQLQuery := TSQLQuery.Create(nil);
try
with ASQLQuery do
begin
SQLConnection := SQLConnection1;
SQL.Text := 'SELECT IDENT_CURRENT(''TABLE_NAME'')';
Open;
ShowMessage(VarToStr(Fields[0].Value));
Result := Fields[0].Value;
Close;
end;
finally
{ With }
ASQLQuery.free;
end;
end;
Thanks alot...
Dave