就是我run的时候他会弹出一个adoconnetion1的窗口来登陆服务器
我现在是想用登陆窗口的形式来取代adoconnetion1的连接窗口的形式进入我的数据库系统
不清楚代码怎么写,我写的代码老是有错误
我的ado默认连接框是adoconnetion1
我的数据库是mmx 代码如下:
我的代码,老是在//if F_main.login then F_login.close;//
说没有定义 login,请问在那里定义呢?
还有,这代码有什么问题
可以实现吗procedure TF_login.Button1Click(Sender: TObject);
var
passwd,passwrd:string;
begin
with DataModule1 do
begin
ADOConnection1.connected:=false;//保证断开连接
//怎么设置服务器,不会写
//连接到服务器
T_user.Filter:='ID='+Quotedstr('+i_user.text+');
T_user.Filtered:=true;
T_user.open;
if T_user.recordcount=1 then
begin
passwd:=i_passwd.Text;
if length(passwd)>5 then
begin
passwd:=copy(passwd+passwd,1,10);
end;
passwrd:=T_user['PASSWD'];
if (passwrd=passwd) then
F_main.login:=true
else
Application.MessageBox('请重新输入密码','密码错误',MB_OK);
end
else
Application.MessageBox('请确认用户名','无此用户',MB_OK);
T_user.close;
end;
if F_main.login then F_login.close;end;end. 谢谢了~
我现在是想用登陆窗口的形式来取代adoconnetion1的连接窗口的形式进入我的数据库系统
不清楚代码怎么写,我写的代码老是有错误
我的ado默认连接框是adoconnetion1
我的数据库是mmx 代码如下:
我的代码,老是在//if F_main.login then F_login.close;//
说没有定义 login,请问在那里定义呢?
还有,这代码有什么问题
可以实现吗procedure TF_login.Button1Click(Sender: TObject);
var
passwd,passwrd:string;
begin
with DataModule1 do
begin
ADOConnection1.connected:=false;//保证断开连接
//怎么设置服务器,不会写
//连接到服务器
T_user.Filter:='ID='+Quotedstr('+i_user.text+');
T_user.Filtered:=true;
T_user.open;
if T_user.recordcount=1 then
begin
passwd:=i_passwd.Text;
if length(passwd)>5 then
begin
passwd:=copy(passwd+passwd,1,10);
end;
passwrd:=T_user['PASSWD'];
if (passwrd=passwd) then
F_main.login:=true
else
Application.MessageBox('请重新输入密码','密码错误',MB_OK);
end
else
Application.MessageBox('请确认用户名','无此用户',MB_OK);
T_user.close;
end;
if F_main.login then F_login.close;end;end. 谢谢了~
解决方案 »
- locate参数问题
- Delphi中对word的控制:OleContainer的Color属性无效!
- 如何判断计算机CPU空闲呢?
- 有人能提供一个基于directshow的视频采集的源代码给我吗?
- Access数据库查询问题
- 在线等待,delphi查询问题?
- 从中英文混排的字符串中去掉字符时,该如何进行
- 有关插入数据的问题
- 请问各位大虾
- 在线程中可使用回调函数吗?
- 大家看看这段程序,里面有详细说明
- An error occurred while attempting to initialize the Borland Database Engine (error $2B05)这是个什么错,应该怎样解决呢?请大家帮
我得一般做法是先用SA登陆SQL,然后再到一个USER表中取用户名、密码进行验证,然后
不过这样做对保密性要求不高
ADOConnection1.connected:=false;//之后
ADOConnection1有一属性可直接连数据库,连后你可以把连接字符串拷贝到程序中。
书写程序时注意格式
我的数据库名称叫:mmx