N
N
Nikita2021-11-02 02:21:20
MySQL
Nikita, 2021-11-02 02:21:20

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


What am I doing wrong?

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question