我的数据库动态连接老是不管用
procedure TLoginFrm.FormCreate(Sender: TObject);
begin
adoconnection1.Close;
adoconnection1.ConnectionString:='Provider=Microsoft.Jet.OLEDB.4.0;Data Source='+extractfilepath(application.ExeName)+'\GXStudent.mdb;Persist Security Info=False';
adoconnection1.Open;
adoquery1.Open;
end;
end.
以上的我的动态连接代码,应该没错,以前就是用的是这个就很用,现在不管用了,不知道为什么?delphi动态链接数据库到底有哪些关键点可讲究呢,望高人不惜赐教!感激涕零!
[解决办法]
- Delphi(Pascal) code
procedure TLoginFrm.FormCreate(Sender: TObject);begin... Source='+extractfilepath(application.ExeName)+'\GXStudent.mdb;Persist Security...end;//////////////////////////////////////把上面的\符号去掉试试
[解决办法]
楼主)+'\GXStudent.mdb;Persist Security Info=False';把'\'去掉
其实用 showmessage(adoconnection1.ConnectionString)即可发现问题所在了。
[解决办法]
adoconnection1.ConnectionString:='Provider=Microsoft.Jet.OLEDB.4.0;Data Source='+extractfilepath(application.ExeName)+'\GXStudent.mdb;Persist Security Info=False';//"\"取了试一下。
[解决办法]
extractfilepath返回的是路径,包含\,所以\是多余的
[解决办法]
你可以吧连接串showmessage出来看看,问题出在哪里,应该很好搞定的。