[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
标签:Dim,VB,rs,Close,Visual,Basic,ADODB,New,conn 来源: https://www.cnblogs.com/lsqwq/p/Application.html