用ado连接sql数据库时,下面的代码为什么第二次执行会报错?
delphi吧
全部回复
仅看楼主
level 7
想实现一个可以切换与数据库连接与关闭的功能,出现如下问题:
con1.ConnectionString:=edt1.Text;
if con1.Connected=True then//这行第二次执行时报错了,显示错误为 对象打开时,不允许操作
begin
con1.Connected:=False;
end
else
begin
tbl1.TableName:='users';
tbl1.Open;
con1.Connected:=True;
end;
求抱腿!
2015年01月05日 16点01分 1
吧务
level 14
tb1.open会自动把con1.connected设置为true
2015年01月05日 23点01分 2
3Q,我把代码换成下面这样 con1.ConnectionString:=edt1.Text; tbl1.TableName:='users'; tbl1.Active:=NOT tbl1.Active;为什么还是报一样的错呢?
2015年01月06日 03点01分
1