我的 ACCESS 文件为 SEAL , 密码:123456
每台电脑装这套软件时都要配置数据源,请问能否让PB自动配置ODBC数据源,最好能详细一点,本人很菜,谢谢啦。
------解决方案--------------------
连接的时候这么连接:
- C/C++ code
sqlca = create transactionsqlca.DBMS = "ODBC"sqlca.Database = "DSN名称" sqlca.UserId = "dba"sqlca.DbPass = ""sqlca.LogPass = ""sqlca.ServerName = ""sqlca.LogId = ""sqlca.DbParm ="ConnectString='DSN=DSN名称;UID=admin;PWD=123456'"sqlca.AutoCommit = falseconnect using sqlca;if sqlca.sqlcode <>0 then messagebox("错误","数据连接失败,系统无法启动!"+sqlca.sqlerrtext) disconnect using sqlca; destroy sqlca return -1end ifreturn 1
------解决方案--------------------
Parent.itrans.DBMS = "ODBC"
ls_connstr = "ConnectString='driver={Microsoft Access Driver (*.mdb)};uid=admin;[email protected]#Com;dbq=" + ls_file + "'"
Parent.itrans.DBMS = "ODBC"
Parent.itrans.AutoCommit = False
Parent.itrans.DBParm = ls_connstr
Connect Using Parent.itrans;
ls_file 为带绝对路径的mdb文件