[英]How can i load DataGridView?
I'm Having Ms Access table Actionpoint with four rows. 我有四个行的女士Access表Actionpoint。 and i am trying to load that in the grid view using the following code 我正在尝试使用以下代码在网格视图中加载它
Dim dt as DataTable
Dim da as New OleDbDataAdapter
con.Open()
da = New OleDbDataAdapter("SELECT * FROM ActionPoint",con)
da.fill(dt)
GridView1.datasource = dt.DefaultView
But it loads only a empty row. 但是它只加载一个空行。 What is the wrong in this code? 这段代码有什么问题? How can i resolve? 我该如何解决?
Change this line 更改此行
GridView1 = dt.DefaultView
to 至
GridView1.DataSource = dt
try this one: 试试这个:
Dim dt as new DataTable
Dim da as New OleDbDataAdapter
con.Open()
da = New OleDbDataAdapter("SELECT * FROM ActionPoint",con)
da.fill(dt)
GridView1.datasource = dt
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.