delphi中DBgrid显示问题,显示不出数据库表中的内容。。
代码在下面:procedureFormClose(Sender:TObject;varAction:TCloseAction);procedureFormCreate(S...
代码在下面:procedure FormClose(Sender: TObject; var Action: TCloseAction);
procedure FormCreate(Sender: TObject);
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
frmxitong: Tfrmxitong;
implementation
uses datam,zhujiemian;
{$R *.dfm}
procedure Tfrmxitong.FormClose(Sender: TObject; var Action: TCloseAction);
begin
frmmain.ShowModal;
end;
procedure Tfrmxitong.FormCreate(Sender: TObject);
begin
Data.ADOQlogin.Close;
Data.ADOQlogin.SQL.Clear;
Data.ADOQlogin.SQL.Add('select * from users');
Data.DataSlogin.DataSet:=Data.ADOQlogin;
Data.ADOQlogin.Open;
end;
procedure Tfrmxitong.Button1Click(Sender: TObject);
begin
if (Edit1.Text<>'') and (Edit2.Text<>'') and (Edit3.Text<>'') and
(ComboBox1.Text<>'') and (Edit2.Text=Edit3.Text) then begin
Data.ADOQlogin.Append;
Data.ADOQlogin['YHM']:=Edit1.Text;
Data.ADOQlogin['MM']:=Edit2.Text;
Data.ADOQlogin['YHQX']:=ComboBox1.Text;
Data.ADOQlogin['DLSJ']:=Now;
Data.ADOQlogin.Post;
MessageDlg('Successed!',mtError,[mbOk],0);
end
else
MessageDlg('Error!Not Null Allowed!',mtError,[mbOK],0);
end; 展开
procedure FormCreate(Sender: TObject);
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
frmxitong: Tfrmxitong;
implementation
uses datam,zhujiemian;
{$R *.dfm}
procedure Tfrmxitong.FormClose(Sender: TObject; var Action: TCloseAction);
begin
frmmain.ShowModal;
end;
procedure Tfrmxitong.FormCreate(Sender: TObject);
begin
Data.ADOQlogin.Close;
Data.ADOQlogin.SQL.Clear;
Data.ADOQlogin.SQL.Add('select * from users');
Data.DataSlogin.DataSet:=Data.ADOQlogin;
Data.ADOQlogin.Open;
end;
procedure Tfrmxitong.Button1Click(Sender: TObject);
begin
if (Edit1.Text<>'') and (Edit2.Text<>'') and (Edit3.Text<>'') and
(ComboBox1.Text<>'') and (Edit2.Text=Edit3.Text) then begin
Data.ADOQlogin.Append;
Data.ADOQlogin['YHM']:=Edit1.Text;
Data.ADOQlogin['MM']:=Edit2.Text;
Data.ADOQlogin['YHQX']:=ComboBox1.Text;
Data.ADOQlogin['DLSJ']:=Now;
Data.ADOQlogin.Post;
MessageDlg('Successed!',mtError,[mbOk],0);
end
else
MessageDlg('Error!Not Null Allowed!',mtError,[mbOK],0);
end; 展开
2个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询