1。 with QDate do begin open; First; Repeat combobox.Items.Add(FieldByName('name').AsString); Next; until EOF; Close; end; end;2。在combobox的OnChange with QDate do begin close; QDate.sql.clear; QDate.sql='slect * from word where [name] ='+combobox.Text; open; edit1.text:=FieldByName('pass').AsString; Close; end; end;
呵呵,错了句 QDate.sql.add('slect * from word where [name] ='+combobox.Text);
搞定了 可是方法不行啊 1。 with QDate do begin open; First; Repeat combobox.Items.Add(FieldByName('name').AsString); Next; until EOF; Close; end; end;这里就没指定是word表的啊?...
我晕 对 ADOQuery 初始化的时候在 SQL语句中不是写的很清楚了 from word 吗 ? 然后才对ADOQuery进行操作啊。 如果 用 ADOTable则就在 Name中指定不就好了
3个问题。 1、name最好不要作为字段名,这是数据库的保留字,如果要使用请这样写[name] 2、遍历数据集记录,使用while比较正规,这样写: with AdoDataSet do begin if active then active:=false; commandtext:='select * from word'; active:=true; combobox1.clear; combobox2.clear; while (not eof) do begin combobox1.items.add(FieldByName('Name').asstring); combobox2.items.add(FieldByName('pass').asstring); Next; end; Close; end; 3、实现你的功能,请在combobox1的onchange时间里写: Edit1.text:=combobox2.items[combobox1.itemindex];
with QDate do
begin
open;
First;
Repeat
combobox.Items.Add(FieldByName('name').AsString);
Next;
until EOF;
Close;
end;
end;2。在combobox的OnChange
with QDate do
begin
close;
QDate.sql.clear;
QDate.sql='slect * from word where [name] ='+combobox.Text;
open;
edit1.text:=FieldByName('pass').AsString;
Close;
end;
end;
QDate.sql.add('slect * from word where [name] ='+combobox.Text);
1。
with QDate do
begin
open;
First;
Repeat
combobox.Items.Add(FieldByName('name').AsString);
Next;
until EOF;
Close;
end;
end;这里就没指定是word表的啊?...
然后才对ADOQuery进行操作啊。 如果 用 ADOTable则就在 Name中指定不就好了
1、name最好不要作为字段名,这是数据库的保留字,如果要使用请这样写[name]
2、遍历数据集记录,使用while比较正规,这样写:
with AdoDataSet do
begin
if active then active:=false;
commandtext:='select * from word';
active:=true;
combobox1.clear; combobox2.clear;
while (not eof) do
begin
combobox1.items.add(FieldByName('Name').asstring);
combobox2.items.add(FieldByName('pass').asstring);
Next;
end;
Close;
end;
3、实现你的功能,请在combobox1的onchange时间里写:
Edit1.text:=combobox2.items[combobox1.itemindex];