vb连接数据库字符串问题
1个回答
展开全部
Private Sub Command5_Click()
myIP="192.168.0.110" '这就是变量IP
Adodc1.ConnectionString = "Server=" & myIP & ";Provider=SQLOLEDB.1;Password=111;Persist Security Info=True;User ID=111;Initial Catalog=111;Data Source=111"
'Adodc1.RecordSource = "T320481TR012004"
Adodc1.RecordSource = "select * from T320481TR012004"
Adodc1.Refresh
Set DataGrid1.DataSource = Adodc1
DataGrid1.Refresh
End SubEnd Sub
myIP="192.168.0.110" '这就是变量IP
Adodc1.ConnectionString = "Server=" & myIP & ";Provider=SQLOLEDB.1;Password=111;Persist Security Info=True;User ID=111;Initial Catalog=111;Data Source=111"
'Adodc1.RecordSource = "T320481TR012004"
Adodc1.RecordSource = "select * from T320481TR012004"
Adodc1.Refresh
Set DataGrid1.DataSource = Adodc1
DataGrid1.Refresh
End SubEnd Sub
追问
Data Source=111 这句是怎么理解?
追答
好久没弄,写错了,前面的Server去掉,这里Data source后加上IP变量
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询