0
Private Sub frmSearchRecords_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim cmd As New MySqlCommand
Dim dr As MySqlDataReader
cmd.Connection = con
connect()
cmd.CommandText = "select * from tblconsumer order by ConsumerID"
dr = cmd.ExecuteReader
While dr.Read
With grdView
.Rows.Add()
.Rows(.RowCount - 1).Cells(0).Value = dr(0).ToString
.Rows(.RowCount - 1).Cells(1).Value = dr(1).ToString
.Rows(.RowCount - 1).Cells(2).Value = dr(2).ToString
.Rows(.RowCount - 1).Cells(3).Value = dr(3).ToString
.Rows(.RowCount - 1).Cells(4).Value = dr(4).ToString
.Rows(.RowCount - 1).Cells(5).Value = dr(5).ToString
.Rows(.RowCount - 1).Cells(6).Value = dr(6).ToString
End With
End While
disconnect()
End Sub
有人能帮助我解决这个,我有这个GridView的数据库,我不能加载在这个GridView控件在数据库中的记录如何显示在数据库记录在GridView在vb.net
请你的问题更具体。例如,提及使用Windows Forms * DataGridView *而不使用ASP.NET * GridView * –