When using
TSQLDataSet.SetSchemaInfo(stColumns, tablename, fieldname)
where tablename and fieldname are string values of the table and column I'm interested in:
I get a result set of Schema Info for every column in my MS SQL table. It really should be returning the Schema Info for the one column I'm interested in.
I now need to locate the column after opening the dataset:
eg:
Code: Select all
dbt := TSQLDataSet.create(nil);
try
dbt.SQLConnection := FSqlConnection;
dbt.GetMetadata := True;
dbt.SetSchemaInfo(stColumns, tableName, fieldName);
dbt.Open;
if not dbt.Eof then
begin
if dbt.fieldByName('COLUMN_NAME').asStringfieldname then
begin
if not dbt.locate('COLUMN_NAME', fieldname, []) then
exit;
end;
//do stuff with Schema Info result here
end;
finally
dbt.Free;
end;
Note, this is hapening with dbExpress driver for Oracle version 4.00 as well. With Interbase driver which comes with Delphi 2007 things work as expected ie one row returned.