1
sqliteデータベースを使用していて、vb.netを使用しています。DataGridviewでいくつかの行を印刷しようとしています。私は、次のコードを使用します。DataGridViewでSQLiteデータを表示するVB.net
Public Sub LoadUsername()
Dim ConnectionString As String = "Data Source=info.sqlite"
Dim nSQL As String = "SELECT Name From employee"
Dim dt As DataTable = Nothing
Dim ds As New DataSet
Try
Using con As New SQLiteConnection(ConnectionString)
Using cmd As New SQLiteCommand(nSQL, con)
con.Open()
Using da As New SQLiteDataAdapter(cmd)
Console.WriteLine(da)
da.Fill(ds)
dt = ds.Tables(0)
End Using
End Using
End Using
ListBox1.ValueMember = "Name"
ListBox1.DisplayMember = "FullName"
ListBox1.DataSource = dt
Catch ex As Exception
MsgBox(ex.Message)
End Try
End Sub
をしかし、私はこのプログラムを実行するか、コンパイル時に、それは私の名前があるべき分野でSystem.Data.DataRowViewを示しています。画像を確認してください。ありがとう!
ListBoxはDataGridViewではありません – Plutonix