[Visual Basic]VB连接数据库

Dim i As Integer,  a(1 To 50) As String
Dim conn As New ADODB.Connection
Dim rs As New ADODB.Recordset 
conn.ConnectionString = "provider=microsoft.ACE.oledb.12.0;data source=" + App.Path + "\xx.accdb"
conn.Open
Set rs.ActiveConnection = conn
rs.Open "select * from xxxxx"
i = 0
Do While Not rs.EOF
   i = i + 1
   a(i) = rs.Fields("名称")
   List1.AddItem a(i)
   rs.MoveNext
Loop
rs.Close
conn.Close
上一篇:Kubernetes Event详述及持久化方案


下一篇:【LeetCode】106. 从中序与后序遍历序列构造二叉树