S
stonehuang
Unregistered / Unconfirmed
GUEST, unregistred user!
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, DB, ADODB;
type
TForm1 = class(TForm)
ADOConnection1: TADOConnection;
Table1: TADOTable;
Edit1: TEdit;
Edit2: TEdit;
ComboBox1: TComboBox;
Button1: TButton;
ADODataSet1: TADODataSet;
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
uses Unit2;
{$R *.dfm}
procedure TForm1.Button1Click(Sender: TObject);
begin
try
ADODataSet1.Close;
ADODataSet1.CommandText:='select * from pws';
adodataset1.CommandType:=cmdtext;
if ((edit1.Text<>'')and(edit2.Text<>''))then
begin
adodataset1.Filtered:=false;
ADODataSet1.Filter:='ID='+quotedstr(Edit1.Text);
ADODataSet1.Filtered:=true;
end;
ADODataSet1.Open;
except
application.Terminate;
end;
if ADODataSet1.RecordCount=1 then
begin
case form1.ComboBox1.ItemIndex of
0:
begin
if ADODataSet1.FieldValues['pws']=quotedstr(Edit2.Text) then
begin
if ADODataSet1.FieldValues['auto']='1' then
begin
form1.Hide;
form2.show;
end;
end
else
application.MessageBox('sss','sss',mb_ok);
end;
end;
end;
end;
end.
我在sql server中建立一个table为pws,有id、pws、auto等三个项目,可就是不能通过点击按钮实现form2的show!!!
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, DB, ADODB;
type
TForm1 = class(TForm)
ADOConnection1: TADOConnection;
Table1: TADOTable;
Edit1: TEdit;
Edit2: TEdit;
ComboBox1: TComboBox;
Button1: TButton;
ADODataSet1: TADODataSet;
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
uses Unit2;
{$R *.dfm}
procedure TForm1.Button1Click(Sender: TObject);
begin
try
ADODataSet1.Close;
ADODataSet1.CommandText:='select * from pws';
adodataset1.CommandType:=cmdtext;
if ((edit1.Text<>'')and(edit2.Text<>''))then
begin
adodataset1.Filtered:=false;
ADODataSet1.Filter:='ID='+quotedstr(Edit1.Text);
ADODataSet1.Filtered:=true;
end;
ADODataSet1.Open;
except
application.Terminate;
end;
if ADODataSet1.RecordCount=1 then
begin
case form1.ComboBox1.ItemIndex of
0:
begin
if ADODataSet1.FieldValues['pws']=quotedstr(Edit2.Text) then
begin
if ADODataSet1.FieldValues['auto']='1' then
begin
form1.Hide;
form2.show;
end;
end
else
application.MessageBox('sss','sss',mb_ok);
end;
end;
end;
end;
end.
我在sql server中建立一个table为pws,有id、pws、auto等三个项目,可就是不能通过点击按钮实现form2的show!!!