关于在Application中连接数据库的问题,急!在线等待
阳明腾越 2003-08-26 09:33:57 PB7.0开发,数据库是ACCESS
在Application中,连接数据库直接用文件连接数据库(就是不用在数据源中写任何东西),可是怎么都连接不上,请高手指教?
APPLICATION 中我是这样写的:
SQLCA.DBMS =ProfileString("XTEXAM.INI","Profile pb70","DBMS", " ")
SQLCA.Database =ProfileString("XTEXAM.INI","Profile pb70","DataBase", " ")
SQLCA.LogID =ProfileString("XTEXAM.INI","Profile pb70","LogID", " ")
SQLCA.LogPass =ProfileString("XTEXAM.INI","Profile pb70","LogPassword", " ")
SQLCA.ServerName =ProfileString("XTEXAM.INI","Profile pb70","ServerName", " ")
SQLCA.Lock =ProfileString("XTEXAM.INI","Profile pb70","Lock", " ")
SQLCA.UserID =ProfileString("XTEXAM.INI","Profile pb70","UserId", " ")
SQLCA.DBPass =ProfileString("XTEXAM.INI","Profile pb70","DatabasePassword", " ")
SQLCA.DbParm ="ConnectString='DSN=archives'"
Connect;
If sqlca.sqlcode < 0 Then
MessageBox ("错误: 不能连接到数据库!",sqlca.sqlerrtext, Exclamation!)
Return
End If
open(w_main)
其中XTEXAM.INI 文件是这样的内容:
[Profile pb70]
DBMS=ODBC
Database=
UserId=
DatabasePassword=
LogPassword=
ServerName=
LogId=
Lock=
DbParm=ConnectString='DSN=archives'
Prompt=0
AutoCommit=0