现在有表(table) 如下:id name ph demo
01 A 12 ZH
02 B 14 AC
03 C 16 DK
我现在想实现的功能是:通过我自己定义的一个widestring.进行和数据库的同步..
const
callerid:widestring;
begin
with adoquery1 do
begin
close;
sql.clear(select id from table where id=callerid);
下面的代码不知道写.因为数据库字段ID的值=callerid也等于edit1.text;
如果callerid=01 时,DBGrid显示的内容就是id=01的内容.并且在edit上也要显示
如果callerid=02时,DBGrid显示的内容就是id=02的内容.并且在edit上也要显示我现在提取的值都是数据表的第一条数据. 不能提第二条数据.我就想通过callerid的值来提取数据库的内容.
麻烦大家帮帮. 不知道我表达明白没有..
01 A 12 ZH
02 B 14 AC
03 C 16 DK
我现在想实现的功能是:通过我自己定义的一个widestring.进行和数据库的同步..
const
callerid:widestring;
begin
with adoquery1 do
begin
close;
sql.clear(select id from table where id=callerid);
下面的代码不知道写.因为数据库字段ID的值=callerid也等于edit1.text;
如果callerid=01 时,DBGrid显示的内容就是id=01的内容.并且在edit上也要显示
如果callerid=02时,DBGrid显示的内容就是id=02的内容.并且在edit上也要显示我现在提取的值都是数据表的第一条数据. 不能提第二条数据.我就想通过callerid的值来提取数据库的内容.
麻烦大家帮帮. 不知道我表达明白没有..
你换其他控件
sql.DataSource.DataSet.RecID := 2;
edit1.Text := sql.DataSource.DataSet.FieldbyName('id').ToString;