初学者,还有很多不是很清楚,请多多关照。
使用tquery对数据库进行操作。
with tquery.create(nil) do
try
close;
sql.clear;
sql.add('select * from table where id=3');
open;
str:=???;//想将查询出来的记录的某一字段值赋给str字符变量,怎么写???
使用tquery对数据库进行操作。
with tquery.create(nil) do
try
close;
sql.clear;
sql.add('select * from table where id=3');
open;
str:=???;//想将查询出来的记录的某一字段值赋给str字符变量,怎么写???
就是楼上的写法.确切的说法应该是:将当前记录指定的字段的值赋给str
str := datasource.dataset.fieldbyname(字段名称).asstring;还有其他类型的,比如asinteger,asfloat,asdatetime等等。