我的写的程序,在一次运行时报错后,执行程序一打开就出现上面的错误,程序根本就无法运行。出错信息指的是我连接数据库时的代码,代码如下:
=====================
with DM_Main.ADOConn do
begin
connectionString:=sqlstr;
try ( 此行为出错指定的行)
open; //打开数据库
if Frm_DBConnection.visible then
Frm_DBConnection.Close; //判断打开是否成功,如果没有成功则打开配置数据库窗口Frm_DBConnection
except
on exception do
If not Connected then
begin
ShowMessage('对不起,数据库连接出错,请重新配置数据连接参数!');
if not Frm_DBConnection.visible then
begin
Frm_DBConnection.ShowModal;
end;
Result:=False;
end
else
begin
if Frm_DBConnection.visible then
begin
Frm_DBConnection.Close;
end;
Result:=True; end;
end; Result:=True;
=====================
with DM_Main.ADOConn do
begin
connectionString:=sqlstr;
try ( 此行为出错指定的行)
open; //打开数据库
if Frm_DBConnection.visible then
Frm_DBConnection.Close; //判断打开是否成功,如果没有成功则打开配置数据库窗口Frm_DBConnection
except
on exception do
If not Connected then
begin
ShowMessage('对不起,数据库连接出错,请重新配置数据连接参数!');
if not Frm_DBConnection.visible then
begin
Frm_DBConnection.ShowModal;
end;
Result:=False;
end
else
begin
if Frm_DBConnection.visible then
begin
Frm_DBConnection.Close;
end;
Result:=True; end;
end; Result:=True;
解决方案 »
- dbgrideh过滤条件怎么替换为中文
- ehlib的GridEh表格中,怎么让其不显示0值。
- 只要一写代码就出现这个错误是怎么回事?
- 如何让CSV文件中的数字栏在Excel中按文本显示
- ****菜鸟问题,立刻结帖 ,大家快来啊*******
- 老问题:在有些系统里TSeverSocket只能连接90-100个TClientSocket.
- 神啊!救救我吧! 我要改名字! 天下的好心人!!
- 那里有windows API的下载,最好有中文的,全面一些的?
- 怎样给dxdbgrid或dxdbTreelist的某一个单元格添加背景图片或设置背景颜色?
- 请高手指点delphi书籍或电子书!
- 今天发现总信誉分张了15,郁闷~~~
- 关于控件制作的两个问题
begin
Close;//加这句我估计可以了
connectionString:=sqlstr;
try ( 此行为出错指定的行)
open; //打开数据库
if Frm_DBConnection.visible then
Frm_DBConnection.Close; //判断打开是否成功,如果没有成功则打开配置数据库窗口Frm_DBConnection
except
on exception do
If not Connected then
begin
ShowMessage('对不起,数据库连接出错,请重新配置数据连接参数!');
if not Frm_DBConnection.visible then
begin
Frm_DBConnection.ShowModal;
end;
Result:=False;
end
else
begin
if Frm_DBConnection.visible then
begin
Frm_DBConnection.Close;
end;
Result:=True; end;
end; Result:=True;
Project project1.exe raised exception Class EOleException with message "Operation is not allow when the object is open",Up,Help me,please!