用ADO连接SQL数据库该怎么连接呢?
请问我要设计个信息查询模块,用ADO连接SQL数据库该怎么连接呢?我右键ADO控件建立连接成功了,执行工程时却有这个提示,
请给个代码我吧.
谢谢了!
Private Sub Form_Load()
Dim strConn As String
Dim pubConn As New ADODB.Connection
Dim rsTable As New ADODB.Recordset
Dim strSQL As String
'strConn = "Provider=SQLOLEDB.1;Integrated Security=SSPI;Persist Security Info=False;User ID=sa;Initial Catalog=kaoqing;Data Source=JANSON"
strConn = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & App.Path & "\hxrkgl.mdb;Persist Security Info=False"
pubConn.Open strConn
rsTable.CursorLocation = adUseClient
strSQL = "select * from mdlk_sj"
'strSQL = "select * from attdcardrec"
rsTable.Open strSQL, pubConn, adOpenDynamic, adLockOptimistic
Set DataGrid1.DataSource = rsTable
End Sub
谁能告诉我这三个地方代表什么吗?我不知该怎么改?
[此贴子已经被作者于2007-5-14 21:43:19编辑过]