procedure Tfrm_login.btn_yesClick(Sender: TObject);
begin
Guser:=trim(edt_user.Text);
Gpwd:=trim(edt_pwd.Text);
try
firstmodule.Firstconnect.Close;
firstmodule.Firstconnect.ConnectionString:=readloginparams();
firstmodule.Firstconnect.LoginPrompt:=false;
firstmodule.Firstconnect.KeepConnection:=true;
firstmodule.Firstconnect.ConnectionTimeout:=5;
firstmodule.Firstconnect.Open;
except
showmessage('数据库打开出错');
end;
frm_main.Show;
frm_login.Hide;
end;
因为输入连接数据库的用户名不正确,运行时出错,我想控制系统错误信息,于是
用以上代码,但整个没反应,请问该如何处理。。
begin
Guser:=trim(edt_user.Text);
Gpwd:=trim(edt_pwd.Text);
try
firstmodule.Firstconnect.Close;
firstmodule.Firstconnect.ConnectionString:=readloginparams();
firstmodule.Firstconnect.LoginPrompt:=false;
firstmodule.Firstconnect.KeepConnection:=true;
firstmodule.Firstconnect.ConnectionTimeout:=5;
firstmodule.Firstconnect.Open;
except
showmessage('数据库打开出错');
end;
frm_main.Show;
frm_login.Hide;
end;
因为输入连接数据库的用户名不正确,运行时出错,我想控制系统错误信息,于是
用以上代码,但整个没反应,请问该如何处理。。
解决方案 »
- delphi调用winexec.exe文件执行解压缩,为什么解压以后把多个文件夹中的内容就存放在一个文件夹中。也没有其他文件夹了。请问有办法解决??
- 求算法
- 如何使用Edit向ADOTable中添加数据?
- d6中的datasnap中的sqlconnection中没有sql server的驱动?
- 有没有人DELPHI和C++BUILDER一块用的??
- 高难度,我做的dll中进行数据库操作,我建立了好几个dll的实例,却出现“无法更新,数据被锁定的错误”
- 一个单元如何调用另一个单元的数组
- 各位大哥:今年程序员的分数线会是多少分?
- 控件使用
- 请教:字符输入控制的问题 !!!
- 如何在程序中修改IIs(或Pws)的默认web目录?
- DELPHI7好用吗?我找不到quickrep控件。
if not firstmodule.Firstconnect.Active then
showmessage('数据库打开出错');
procedure Tfrm_login.btn_yesClick(Sender: TObject);
begin
Guser:=trim(edt_user.Text);
Gpwd:=trim(edt_pwd.Text);
try
firstmodule.Firstconnect.Close;
firstmodule.Firstconnect.ConnectionString:=readloginparams();
firstmodule.Firstconnect.LoginPrompt:=false;
firstmodule.Firstconnect.KeepConnection:=true;
firstmodule.Firstconnect.ConnectionTimeout:=5;
firstmodule.Firstconnect.Open;
if not firstmodule.Firstconnect.Active then
showmessage('数据库打开出错');
else
begin
frm_main.Show;
frm_login.Hide;
end;
end;
2 单步调试一下,看看
begin
Guser:=trim(edt_user.Text);
Gpwd:=trim(edt_pwd.Text);firstmodule.Firstconnect.Close;
firstmodule.Firstconnect.ConnectionString:=readloginparams();
firstmodule.Firstconnect.LoginPrompt:=false;
firstmodule.Firstconnect.KeepConnection:=true;
firstmodule.Firstconnect.ConnectionTimeout:=5;
try
firstmodule.Firstconnect.Open;
except
showmessage('数据库打开出错');
application.terminate; //如果其frm_main调用了数据模块的话
end;
frm_main.Show;
frm_login.Hide;
end;
我想说我的是动态连接,没有加ADO控件;不知还有其他办法么,请赐教
在线等
非常感谢。。
firstmodule.Firstconnect.Open;
if not firstmodule.Firstconnect.connected then
showmessage('数据库打开出错');