Answer the question
In order to leave comments, you need to log in
How to draw inference from MySQL DB in Data Grid VB?
Goodnight. I'm trying to display the database in a DataGrid (I have 4 columns), but it starts throwing an error:
: "Could not cast object type 'System.Data.DataTable' to type 'System.Collections.IEnumerable'.""
Dim sqlConn As New MySqlConnection
Dim sqlCmd As New MySqlCommand
Dim sqlData As New DataTable
Private Sub updateTable()
Dim DataSuspects As New DataGrid
sqlConn.ConnectionString = "server =" + server + ";" + "user id=" + username + ";" + "password= " + password + ";" + "database =" + database
Dim query As String
query = "SELECT * FROM `suspects_arrests`"
Dim sqlAdap As New MySqlDataAdapter(query, sqlConn)
sqlAdap.Fill(sqlData)
DataSuspects.ItemsSource = sqlData
End Sub
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question