procedure TForm1.FormCreate(Sender: TObject);
begin
with adotable1 do
begin
Open;
while not eof do
begin
combobox1.Items.Add(fieldbyname('name').asstring);
next;
end;
combobox1.Text:=combobox1.Items[0];
close;
end;
end;
procedure TForm1.Button2Click(Sender: TObject);
begin
application.Terminate;
end;procedure TForm1.Button1Click(Sender: TObject);
var strpassword:string;
begin
adotable1.DisableControls;
adotable1.Locate('name',combobox1.Text,[lopartialkey]);
strpassword:=adotable1['password'];
adotable1.EnableControls;
if edit1.Text=strpassword then showmessage('成功登录');
end;
begin
with adotable1 do
begin
Open;
while not eof do
begin
combobox1.Items.Add(fieldbyname('name').asstring);
next;
end;
combobox1.Text:=combobox1.Items[0];
close;
end;
end;
procedure TForm1.Button2Click(Sender: TObject);
begin
application.Terminate;
end;procedure TForm1.Button1Click(Sender: TObject);
var strpassword:string;
begin
adotable1.DisableControls;
adotable1.Locate('name',combobox1.Text,[lopartialkey]);
strpassword:=adotable1['password'];
adotable1.EnableControls;
if edit1.Text=strpassword then showmessage('成功登录');
end;
operation on a closed dataset,不能执行操作在关闭的数据集上。
你的FormCreate最后把那个给关闭掉。
procedure TForm1.FormCreate(Sender: TObject);
begin
with adotable1 do
begin
Open;
while not eof do
begin
combobox1.Items.Add(fieldbyname('name').asstring);
next;
end;
combobox1.Text:=combobox1.Items[0];
// close;这里别急着关闭!
end;
end;procedure TForm1.Button2Click(Sender: TObject);
begin
application.Terminate;
end;procedure TForm1.Button1Click(Sender: TObject);
var strpassword:string;
begin
adotable1.DisableControls;
if adotable1.Locate('name',combobox1.Text,[lopartialkey]) then
begin
strpassword:=adotable1['password'];
if edit1.Text=strpassword then showmessage('成功登录')
else showmessage('密码错误');
end
else showmessage('无此账户');
adotable1.EnableControls;
end;
参数lopartialkey什么意思?
这样空着那参数就行了。大家都回了你的问题,怎么不结贴呢?
这已经不是同一个问题了吧