
DELPHI + SQL登陆窗体
我做了一个窗体是用delphi和SQL2000做的.主要控件为datasource和table1控件.数据源已经建立好,代码如下unitlogin;interfaceus...
我做了一个窗体是用delphi和SQL 2000做的.
主要控件 为 datasource 和table1控件.
数据源已经建立好,代码如下
unit login;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, DB, DBTables, StdCtrls, Buttons, DBCtrls, jpeg, ExtCtrls;
type
Tloginform = class(TForm)
Image1: TImage;
Label1: TLabel;
Label2: TLabel;
DBLookupComboBox1: TDBLookupComboBox;
Label3: TLabel;
edit1: TEdit;
BitBtn1: TBitBtn;
BitBtn2: TBitBtn;
DataSource1: TDataSource;
Table1: TTable;
procedure FormShow(Sender: TObject);
procedure BitBtn2Click(Sender: TObject);
procedure BitBtn1Click(Sender: TObject);
procedure FormClose(Sender: TObject; var Action: TCloseAction);
procedure DBLookupComboBox1KeyPress(Sender: TObject; var Key: Char);
procedure Edit1KeyPress(Sender: TObject; var Key: Char);
private
tim:integer;
{ Private declarations }
public
{ Public declarations }
end;
var
loginform: Tloginform;
implementation
{$R *.dfm}
procedure Tloginform.FormShow(Sender: TObject);
begin
tim:=0;
end;
procedure Tloginform.BitBtn2Click(Sender: TObject);
begin
application.Terminate;
end;
procedure Tloginform.BitBtn1Click(Sender: TObject);
begin
if dblookupcombobox1.Text='' then
begin
messagebox(loginform.Handle,'请选择用户名!','信息',mb_iconasterisk);
dblookupcombobox1.SetFocus;
end
else
begin
if edit1.Text<>Table1.user['password'] then ((这里提示出错)
begin
tim:=tim+1;
if tim<3 then
begin
messagebox(loginform.Handle,'密码输入错误,请重新输入!','信息',mb_iconerror);
edit1.Text:='';
edit1.SetFocus;
end
else
begin
messagebox(loginform.Handle,'密码三次输入错误,请与管理员联系!','信息',mb_iconerror);
application.Terminate;
end;
end
else
begin
main.ShowModal;
close;
end;
end;
end;
procedure Tloginform.DBLookupComboBox1KeyPress(Sender: TObject;
var Key: Char);
begin
if key=#13 then
begin
key:=#0;
edit1.SetFocus;
end;
end;
procedure Tloginform.Edit1KeyPress(Sender: TObject; var Key: Char);
begin
if key=#13 then
begin
key:=#0;
bitbtn1.SetFocus;
end;
end;
end.
这里出现问题.if edit1.Text<>Table1.user['password'] then
请哪位大侠看看..小弟重谢! 展开
主要控件 为 datasource 和table1控件.
数据源已经建立好,代码如下
unit login;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, DB, DBTables, StdCtrls, Buttons, DBCtrls, jpeg, ExtCtrls;
type
Tloginform = class(TForm)
Image1: TImage;
Label1: TLabel;
Label2: TLabel;
DBLookupComboBox1: TDBLookupComboBox;
Label3: TLabel;
edit1: TEdit;
BitBtn1: TBitBtn;
BitBtn2: TBitBtn;
DataSource1: TDataSource;
Table1: TTable;
procedure FormShow(Sender: TObject);
procedure BitBtn2Click(Sender: TObject);
procedure BitBtn1Click(Sender: TObject);
procedure FormClose(Sender: TObject; var Action: TCloseAction);
procedure DBLookupComboBox1KeyPress(Sender: TObject; var Key: Char);
procedure Edit1KeyPress(Sender: TObject; var Key: Char);
private
tim:integer;
{ Private declarations }
public
{ Public declarations }
end;
var
loginform: Tloginform;
implementation
{$R *.dfm}
procedure Tloginform.FormShow(Sender: TObject);
begin
tim:=0;
end;
procedure Tloginform.BitBtn2Click(Sender: TObject);
begin
application.Terminate;
end;
procedure Tloginform.BitBtn1Click(Sender: TObject);
begin
if dblookupcombobox1.Text='' then
begin
messagebox(loginform.Handle,'请选择用户名!','信息',mb_iconasterisk);
dblookupcombobox1.SetFocus;
end
else
begin
if edit1.Text<>Table1.user['password'] then ((这里提示出错)
begin
tim:=tim+1;
if tim<3 then
begin
messagebox(loginform.Handle,'密码输入错误,请重新输入!','信息',mb_iconerror);
edit1.Text:='';
edit1.SetFocus;
end
else
begin
messagebox(loginform.Handle,'密码三次输入错误,请与管理员联系!','信息',mb_iconerror);
application.Terminate;
end;
end
else
begin
main.ShowModal;
close;
end;
end;
end;
procedure Tloginform.DBLookupComboBox1KeyPress(Sender: TObject;
var Key: Char);
begin
if key=#13 then
begin
key:=#0;
edit1.SetFocus;
end;
end;
procedure Tloginform.Edit1KeyPress(Sender: TObject; var Key: Char);
begin
if key=#13 then
begin
key:=#0;
bitbtn1.SetFocus;
end;
end;
end.
这里出现问题.if edit1.Text<>Table1.user['password'] then
请哪位大侠看看..小弟重谢! 展开
1个回答
展开全部
错误提示是什么?
有可能出现的问题:表未打开,user表未拼对,字段password未拼对
有可能出现的问题:表未打开,user表未拼对,字段password未拼对

2023-12-06 广告
UIkit是一套轻量级、模块化且易于使用的开源UI组件库,由YOOtheme团队开发。它提供了丰富的界面元素,包括按钮、表单、表格、对话框、滑块、下拉菜单、选项卡等等,适用于各种类型的网站和应用程序。UIkit还支持响应式设计,可以根据不同...
点击进入详情页
本回答由网易云信提供
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询