16,554
社区成员
发帖
与我相关
我的任务
分享
Public Class Form1
Public MyCnn As ADODB.Connection
Public MyRs As ADODB.Recordset
Public strCnn As String
Public strSQL As String
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Try
MyCnn = New ADODB.Connection
MyRs = New ADODB.Recordset
strCnn = "PROVIDER=Microsoft.Jet.OLEDB.4.0;Data Source=D:\Data.mdb"
MyCnn.Open(strCnn)
Catch ex As Exception
MsgBox(ex.Message, MsgBoxStyle.OkOnly)
End Try
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
strSQL = "Select * From 表1"
MyRs.Open(strSQL, MyCnn, ADODB.CursorTypeEnum.adOpenStatic, ADODB.LockTypeEnum.adLockOptimistic)
‘以下应该如何操作,谢谢
End Sub
End Class