我想获取MySQL数据库的所有表行并将它们存储在列表框中。我正在使用vb.net。提前谢谢。
答案 0 :(得分:0)
Dim connection As New SqlConnection
Dim cmd As New SqlCommand
Dim dr As SqlDataReader
Dim Column0 As String
connection.ConnectionString = "Data Source=localhost; Initial Catalog=catalogname; Integrated Security=True; Connection Timeout=3"
Dim query As String = "SELECT * FROM MyDB"
connection.Open()
cmd = New SqlCommand(query, connection)
dr = cmd.ExecuteReader
If dr.Read() Then
Column0 = dr(0)
End If
connection.Close()