请问在VB中使用ado对象如何完成SQL查询,并用DataGrid显示
请问在VB中使用ado对象如何完成SQL查询,并用DataGrid显示
[解决办法]
Dim cn As Object, rs As Object
Set cn = New ADODB.Connection
Set rs = New ADODB.Recordset
If cn.State = adStateOpen Then cn.Close
cn.Provider = "Microsoft.Jet.OLEDB.4.0 "
cn.ConnectionString = App.Path & "\data\yyzlgl.mdb "
cn.Open
Set rs.ActiveConnection = cn
rs.CursorType = adOpenStatic
rs.LockType = adLockOptimistic
rs.Open "SELECT * FROM TABLE "