好的,所以我尝试使用数据网格视图显示我的 MYSQL 数据库中的所有内容。但我得到的是不工作,有人可以帮助我的代码
Public Sub dataview()
DataGridView1.DataSource = ""
Dim bindingSource1 As New BindingSource()
Try
Dim cmd As New MySqlCommand("SELECT * FROM upload", db_con)
With Me.DataGridView1
.AutoGenerateColumns = True
bindingSource1.DataSource = cmd
.DataSource = bindingSource1
.AutoSizeRowsMode = DataGridViewAutoSizeRowsMode.DisplayedCellsExceptHeaders
.BorderStyle = BorderStyle.Fixed3D
.EditMode = DataGridViewEditMode.EditOnEnter
End With
DataGridView1.DataSource = bindingSource1
Catch ex As Exception
MessageBox.Show("something went wrong")
End Try