In PowerBuilder, you can connect a database thru ODBC, but no need to create a DOBC DNS. for example, to connect a MS Access database (.mdb):
string ls_connstr
string ls_dbname = d:/database.mdb
ls_connstr = "ConnectString='driver={Microsoft Access Driver (*.mdb)};dbq="+ls_dbname+"'"
SQLCA.DBMS = "ODBC"
SQLCA.AutoCommit = true
SQLCA.DBParm = ls_connstr
connect using SQLCA ;
if SQLCA.sqlcode <> 0 then
messagebox('Connect Error", SQLCA.SqlErrText)
end if
介绍了在PowerBuilder中连接数据库的方法,无需创建ODBC DNS。给出了连接MS Access数据库(.mdb)的示例代码,包括连接字符串的设置、SQLCA参数配置及连接操作,还对连接失败情况进行了处理。
1261

被折叠的 条评论
为什么被折叠?



