Connect via an IP address: "Provider=sqloledb;Data Source=190.190.200.100,1433;Network Library=DBMSSOCN;Initial Catalog=pubs;User ID=sa;Password=asdasd;" (DBMSSOCN=TCP/IP instead of Named Pipes, at the end of the Data Source is the port to use (1433 is the default))
'工程-〉引用 Microsoft Active Data Objects 2.x(x表示版本号) Dim cn As New ADODB.Connection Dim rs As New Recordset cn.ConnectionString = "Provider=sqloledb;Data Source=127.0.0.1;Initial Catalog=pubs;User Id=sa;Password=lyjlee;" cn.Open rs.Open "authors", cn, adOpenKeyset, adLockOptimistic
VB 和 SQL Server 编程指南(第五版)不错 http://freezing.myrice.com/dnsj/s7.htm http://cnprogram.myrice.com/book/http://www1.baidu.com/baidu?cl=3&tn=baidu&word=VB+%BA%CD+SQL+Server+%B1%E0%B3%CC%D6%B8%C4%CF%A3%A8%B5%DA%CE%E5%B0%E6%A3%A9
"Provider=sqloledb;Data Source=190.190.200.100,1433;Network Library=DBMSSOCN;Initial Catalog=pubs;User ID=sa;Password=asdasd;"
(DBMSSOCN=TCP/IP instead of Named Pipes, at the end of the Data Source is the port to use (1433 is the default))
Dim cn As New ADODB.Connection
Dim rs As New Recordset
cn.ConnectionString = "Provider=sqloledb;Data Source=127.0.0.1;Initial Catalog=pubs;User Id=sa;Password=lyjlee;"
cn.Open
rs.Open "authors", cn, adOpenKeyset, adLockOptimistic
http://freezing.myrice.com/dnsj/s7.htm
http://cnprogram.myrice.com/book/http://www1.baidu.com/baidu?cl=3&tn=baidu&word=VB+%BA%CD+SQL+Server+%B1%E0%B3%CC%D6%B8%C4%CF%A3%A8%B5%DA%CE%E5%B0%E6%A3%A9