vb6.0+sql 2005

冰天天 2008-01-21 01:31:18
cn.ConnectionString = "Provider=SQLOLEDB.1;Password=dell;Persist Security Info=false;User ID=sa;Initial Catalog=fe1material;Data Source=10.192.152.243"
我用这个连接sql2000,但连接sql2005报错,请问VB6.0怎样连接sql2005,与Sql2000有什么不同,谢谢!
...全文
189 点赞 收藏 8
写回复
8 条回复
切换为时间正序
请发表友善的回复…
发表回复
深渊的水影 2008-01-23
strConn = "Provider=sqloledb;" & _
"Data Source=" & strServer & _
";Initial Catalog=" & strInitDB & _
";User Id=" & strUser & _
";Password=" & strPwd & ";"
回复
zzyong00 2008-01-21
是不是哪个sql2005 express??
回复
vbman2003 2008-01-21
VB下没用过SQL2005
参见:http://www.connectionstrings.com
回复
冰天天 2008-01-21
报错 实时错误 '-2147467259(80004005)'
Invalid connection string attribute
回复
Ankeyfu 2008-01-21
To connect via an IP address:
oConn.Open "Provider=sqloledb;" & _
          "Data Source=xxx.xxx.xxx.xxx,1433;" & _
          "Network Library=DBMSSOCN;" & _
          "Initial Catalog=myDatabaseName;" & _
          "User ID=myUsername;" & _
          "Password=myPassword;"
回复
Ankeyfu 2008-01-21
- xxx.xxx.xxx.xxx is an IP address
- "Network Library=DBMSSOCN" tells OLE DB to use TCP/IP rather than Named Pipes (Q238949)
- 1433 is the default port number for SQL Server
- You can also add "Encrypt=yes" for encryption
For more information, see: Microsoft OLE DB Provider for SQL Server
回复
冰天天 2008-01-21
Network Library=DBMSSOCN
这句是啥意思?
回复
Ankeyfu 2008-01-21

Provider=sqloledb;" & _
"Data Source=" & DataSource & ";" & _
"Network Library=DBMSSOCN;" & _
"Initial Catalog=" & InitialCatalog & ";" & _
"User ID=" & Uid & ";" & _
"Password=" & Pwd & ";



事實上我在用我上面的字符串聯接時並沒有報錯,你也可以試試.
回复
发动态
发帖子
VB基础类
创建于2007-09-28

7453

社区成员

VB 基础类
申请成为版主
社区公告
暂无公告