I'm trying to make a query in the database and display it in a datagrid
, I do not have as much experience, I do technical course and it's my first question here, the code I'm using is this:
Public Sub PreencheDataGrid(ByRef x As DataGridView, ByVal op1 As Integer, ByVal op2 As Integer)
Dim SDA As New MySqlDataAdapter
Dim bSource As New BindingSource
conectaBanco()
Dim query As String
query = "SELECT * FROM vw_tb_clientes"
objcmd = New MySqlCommand(query, con)
SDA.SelectCommand = objcmd
SDA.Fill(dbDataSet)
bSource.DataSource = dbDataSet
'Deixa o DataGridView limpo
x.DataSource = Nothing
x.DataSource = bSource
SDA.Update(dbDataSet)
fechaBanco()
End Sub
As I understand with my debug , the error is in the code SDA.Fill(dbDataSet)
, but I do not know what is happening since I have another datagridview
with almost the same code and functional, someone could you help me?