VB.NET中DataGridView控件怎么使用
如何用代码实现数据的绑定,我写了一个,可以连接到表,可是却不显示数据!大家帮帮忙吧!DimconnAsOleDbConnectionDimdataTableAsOleDb...
如何用代码实现数据的绑定,我写了一个,可以连接到表,可是却不显示数据!大家帮帮忙吧!
Dim conn As OleDbConnection
Dim dataTable As OleDbDataAdapter
Dim dataSet As DataSet
Dim strSQL As String
Private Sub oprData_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
conn = New OleDbConnection()
conn = getDB_Conn()
'conn.Open()
strSQL = "select * from sys_hairstyle"
dataTable = New OleDbDataAdapter(strSQL, conn)
dataSet = New DataSet
dataTable.Fill(dataSet)
DataGridViewInfo.DataSource = dataSet.Tables(0)
DataGridViewInfo.AutoResizeRows()
conn.Close()
End Sub 展开
Dim conn As OleDbConnection
Dim dataTable As OleDbDataAdapter
Dim dataSet As DataSet
Dim strSQL As String
Private Sub oprData_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
conn = New OleDbConnection()
conn = getDB_Conn()
'conn.Open()
strSQL = "select * from sys_hairstyle"
dataTable = New OleDbDataAdapter(strSQL, conn)
dataSet = New DataSet
dataTable.Fill(dataSet)
DataGridViewInfo.DataSource = dataSet.Tables(0)
DataGridViewInfo.AutoResizeRows()
conn.Close()
End Sub 展开
2013-08-15
展开全部
DataGridViewInfo.AutoResizeRows()
应该这句有问题,后面应该是绑定好像是binder
应该这句有问题,后面应该是绑定好像是binder
2013-08-15
展开全部
你的代码写错了
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询