送50分,为什么我的机器连sql server总出错(DBNMPNTW找不到指定的sql server)
我用odbc创建一个数据源如mydata,用的是sql server里的pubs数据库,我的连接语法如下: Dim cnn1 As ADODB.Connection
Dim rstEmployees As ADODB.Recordset
Dim strCnn As String
' Open connection.
strCnn = "Provider=sqloledb;" & _
"Data Source=mydata;Initial Catalog=Pubs;User Id=sa;Password=; "
Set cnn1 = New ADODB.Connection
cnn1.Open strCnn
也用过
Set AdoCne = New ADODB.Connection
AdoCne.ConnectionTimeout = 15
AdoCne.CommandTimeout = 300
AdoCne.CursorLocation = adUseServer
sConStr = "Provider=SQLOLEDB;"
sConStr = sConStr & "Server=local;"
sConStr = sConStr & "Uid=sa;"
sConStr = sConStr & "Pwd=;"
sConStr = sConStr & "Auto Translate=false;"
sConStr = sConStr & "Database=mydata"
AdoCne.ConnectionString = sConStr
On Error GoTo err_login
AdoCne.Open
可是都出现上面的错误,我现在快急死了,有那位大侠帮帮我,我感激不尽我的信箱是
jxh_jxh@371.net另外,我装的是win98单机sql7,调用pubs数据库,uid=sa,pwd=“”
希望高手编个例程给我发到信箱,在下感激不尽,再次谢谢诸位了。