Dim CN As New ADODB.Connection '定义数据库的连接存放数据和代码 Dim Rs As New ADODB.Recordset CN.ConnectionString = "Provider=sqloledb;Data Source=pmserver;Initial Catalog=northwind;User Id=sa;Password=sa;" CN.Open Rs.CursorLocation = adUseClient Rs.Open "select * from employees", CN, adOpenDynamic, adLockBatchOptimistic Set DataGrid1.DataSource = Rs
"Persist Security Info=False;Initial Catalog=" & ServerName & "_" & DatabaseName & ";Data Source=" & tablename
为什么你们的都是Provider=SQLOLEDB.1啊?而我的却是Provider=MSDASQL.1??这是我程序里另一个设好的adodc的connectionstring,谁帮我看看怎么回事?
Provider=MSDASQL.1;Persist Security Info=False;Extended Properties="DRIVER=SQL
Server;SERVER=COMPANY-J4IQ55E;APP=Visual Basic;WSID=COMPANY-J4IQ55E;DATABASE=SCMDB;LANGUAGE=简体中文;Trusted_Connection=Yes";Initial Catalog=SCMDB
Dim Rs As New ADODB.Recordset
CN.ConnectionString = "Provider=sqloledb;Data Source=pmserver;Initial Catalog=northwind;User Id=sa;Password=sa;"
CN.Open
Rs.CursorLocation = adUseClient
Rs.Open "select * from employees", CN, adOpenDynamic, adLockBatchOptimistic
Set DataGrid1.DataSource = Rs