PB10中 利用ODBC链接网络数据库SQL Server2000

还有人用VB6吗 2007-11-16 07:58:52
我用的是PB10.0,怎么没有PB9中的直连 MSS Microsoft SQL Server选项啊?

现在我用ODBC连接 服务器中的SQL Server2000数据库,
每次连接时都弹出 “SQL Server 登录” 对话框,输入用户名和密码
如果设置为信任连接,就登录失败,

怎么在程序里直接设置好访问的用户名和密码啊?

程序里,访问数据库我已经输入用户名和密码了啊,下边是我的连接数据库源码

//连接数据库
//从配置文件setup.ini中读取连接信息
SQLCA.DBMS = ProfileString( as_inifile, "System_Set", "DBMS", "ODBC" )
SQLCA.DataBase = ProfileString( as_inifile, "System_Set", "DataBase", "YMData" )
SQLCA.LogID = ProfileString( as_inifile, "System_Set", "LogID", "" )
SQLCA.LogPass = ProfileString( as_inifile, "System_Set", "LogPassword", "" )
SQLCA.ServerName = ProfileString( as_inifile, "System_Set", "SeverName", "" )
SQLCA.UserID = ProfileString( as_inifile, "System_Set", "UserID", "sa" )
SQLCA.DBPass = ProfileString( as_inifile, "System_Set", "DatabasePassword", "" )
SQLCA.Lock = ProfileString( as_inifile, "System_Set", "Lock", "" )
SQLCA.DbParm = ProfileString( as_inifile, "System_Set", "DbParm", "Connectstring='DSN=YMData'" )
SQLCA.AutoCommit = false

CONNECT USING SQLCA;
IF SQLCA.SQLCode <> 0 THEN
Beep( 1)
MessageBox( '连接错误' ,"数据库连接失败,无法连接数据库,请检查:~r~n~n"+ &
"1.数据库文件是否损坏.~r~n~n"+ &
"2.数据库服务器与客户机的连接通路.~r~n~n" + &
"3.错误信息:"+ SQLCA.SQLerrText, StopSign! )
return -1
Halt Close
ELSE
return 1
END IF
...全文
157 3 打赏 收藏 转发到动态 举报
写回复
用AI写文章
3 条回复
切换为时间正序
请发表友善的回复…
发表回复
SatanAngel 2007-11-16
  • 打赏
  • 举报
回复
SQLCA.DBMS = "OLE DB"
SQLCA.LogPass = "password"
SQLCA.LogId = "sa"
SQLCA.AutoCommit = False
SQLCA.DBParm = "PROVIDER='SQLOLEDB',DATASOURCE='127.0.0.1',PROVIDERSTRING='database=dataname;AutoTranslate=no',DBTextLimit='8000'"
SQLCA.Lock = "RC"
SatanAngel 2007-11-16
  • 打赏
  • 举报
回复
建odbc了吗,直接在odbc那里可以连吗?或者用ole连接
ShingU 2007-11-16
  • 打赏
  • 举报
回复

从10开始就没有直连SQL Server的选项了。

你可以先试一下不用ProfileString,直接在程序里写入用户名和密码,看行不行。

1,075

社区成员

发帖
与我相关
我的任务
社区描述
PowerBuilder 相关问题讨论
社区管理员
  • 基础类社区
  • WorldMobile
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧