S
stonehuang
Unregistered / Unconfirmed
GUEST, unregistred user!
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, DB, DBTables, StdCtrls, ADODB;
type
TForm1 = class(TForm)
DataSource1: TDataSource;
ComboBox1: TComboBox;
Edit1: TEdit;
Edit2: TEdit;
Button1: TButton;
Table1: TTable;
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
table1.Filter:='ID='''+form1.Edit1.Text+'''';
table1.Filtered:=true;
table1.Open;
if table1.RecordCount=1 then
begin
case form1.ComboBox1.ItemIndex of
0:
begin
if table1['pws']=form1.Edit2.Text then
begin
if table1['authority']='1' then
begin
form1.Hide;
form2.show;
end;
end
else
application.MessageBox('sss','sss',mb_ok);
end;
end;
end;
end;
end.
上面的代码可以成功执行!
当我把其中的table换成adotable后,就无法实现此功能了,请问为什么????
那怎么才可以用adotable实现我上面的功能呢?adotable的可以连接数据库呢!!!
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, DB, DBTables, StdCtrls, ADODB;
type
TForm1 = class(TForm)
DataSource1: TDataSource;
ComboBox1: TComboBox;
Edit1: TEdit;
Edit2: TEdit;
Button1: TButton;
Table1: TTable;
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
table1.Filter:='ID='''+form1.Edit1.Text+'''';
table1.Filtered:=true;
table1.Open;
if table1.RecordCount=1 then
begin
case form1.ComboBox1.ItemIndex of
0:
begin
if table1['pws']=form1.Edit2.Text then
begin
if table1['authority']='1' then
begin
form1.Hide;
form2.show;
end;
end
else
application.MessageBox('sss','sss',mb_ok);
end;
end;
end;
end;
end.
上面的代码可以成功执行!
当我把其中的table换成adotable后,就无法实现此功能了,请问为什么????
那怎么才可以用adotable实现我上面的功能呢?adotable的可以连接数据库呢!!!