I'm trying to create a function to update the Datagridview. I added the following code but a "Can not clean list" error
Code:
Private Sub GetData()
Try
con = New SqlConnection(cs)
con.Open()
cmd = New SqlCommand("SELECT nome, matricula, marca, [Licenca-emissao], [licenca-expira] from Clientes order by Nome", con)
rdr = cmd.ExecuteReader(CommandBehavior.CloseConnection)
dgw.Rows.Clear()
While (rdr.Read() = True)
dgw.Rows.Add(rdr(0), rdr(1))
End While
con.Close()
Catch ex As Exception
MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error)
End Try
End Sub