Board index » delphi » weird dbExpress behaviour

weird dbExpress behaviour


2006-10-30 05:46:02 PM
delphi232
Hi!
Im using D2006 dbExpress components (TSQLConnection and TSQLQuery) to
connect to MS SQL server via dbexpsda30.dll driver.After opening the query
and accessing .FieldByName property, the property works fine as long as i
dont connect a TDataSource to the query. Afterwards all .Fields[].Value and
FieldByName('').Value dont return the value.
Example:
qQuery.SQL.Add('Select anName from Users');
qQuery.Open;
ShowMessage(qQuery.FieldByName('acName').AsString); //retruns value
dsDatasource.DataSet:= qQuery;
ShowMessage(qQuery.FieldByName('acName').AsString); //nothing is returned
Can anyone explain that?
Thx in advance.
Regards, Andrej
 
 

Re:weird dbExpress behaviour

Użytkownik "Andrej" <XXXX@XXXXX.COM>napisa?w wiadomości
Quote
Hi!

Im using D2006 dbExpress components (TSQLConnection and TSQLQuery) to
connect to MS SQL server via dbexpsda30.dll driver.After opening the query
and accessing .FieldByName property, the property works fine as long as i
dont connect a TDataSource to the query. Afterwards all .Fields[].Value
and FieldByName('').Value dont return the value.

Example:

qQuery.SQL.Add('Select anName from Users');
qQuery.Open;
ShowMessage(qQuery.FieldByName('acName').AsString); //retruns value

dsDatasource.DataSet:= qQuery;
ShowMessage(qQuery.FieldByName('acName').AsString); //nothing is returned

First i do not see any difference bettwen
ShowMessage(qQuery.FieldByName('acName').AsString); //retruns value
and this line
ShowMessage(qQuery.FieldByName('acName').AsString); //nothing is returned
but in first line
qQuery.SQL.Add('Select anName from Users');
is "anName" and in next lines you look for acName
Karol Bieniaszewski