DataGrid - 数据集 [英] DataGrid - Dataset
问题描述
受保护的子Page_Load(ByVal sender As Object,ByVal e As System.EventArgs)
[连接对象创建]
Dim sSQL As String =" SELECT * FROM tPlayers"
Dim myAdapter As OleDbDataAdapter = New
OleDbDataAdapter(sSQL,myConnection)
Dim MyDataSet作为新数据集
myAdapter.Fill(MyDataSet)
GridView1.DataSource = MyDataSet
GridView1。 DataBind()
myConnection.Close()
End Sub
我知道连接对象很好,因为我在其他地方使用它,我从上面的事件中编辑了
。
我有需要的命名空间,所以它必须是语法,但我不能对于
我的生活看看问题是什么。
其他人可以吗?
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs)
[connection object creation]
Dim sSQL As String = "SELECT * FROM tPlayers"
Dim myAdapter As OleDbDataAdapter = New
OleDbDataAdapter(sSQL,myConnection)
Dim MyDataSet As New DataSet
myAdapter.Fill(MyDataSet)
GridView1.DataSource = MyDataSet
GridView1.DataBind()
myConnection.Close()
End Sub
I know the connection object is good because I use it else where, I have
edited out from the event above.
I have the require Namespaces , so it must be syntax, but I cannot for the
life of me see what the problem is.
Can anyone else?
推荐答案
GridView1.DataSource = MyDataSet.Tables [0];
DataSet是一个集合DataTables。
你必须选择一张桌子。
" Paul W Smith" < pw*@NOSPAM.twelve.me.ukwrote in message
news:%2 **************** @ TK2MSFTNGP03.phx.gbl .. 。
GridView1.DataSource = MyDataSet.Tables[0];
A DataSet is a collection of DataTables.
You have to pick a Table.
"Paul W Smith" <pw*@NOSPAM.twelve.me.ukwrote in message
news:%2****************@TK2MSFTNGP03.phx.gbl...
受保护的子Page_Load(ByVal发送者为对象,ByVal e As
System.EventArgs)
[连接对象创建]
Dim sSQL As String =" SELECT * FROM tPlayers"
Dim myAdapter As OleDbDataAdapter = New
OleDbDataAdapter(sSQL,myConnection)
Dim MyDataSet As New DataSet
myAdapter.Fill(MyDataSet)
GridView1.DataSource = MyDataSet
GridView1.DataBind()
myConnection.Close()
End Sub
我知道连接对象很好,因为我在其他地方使用它,我有
从上面的事件中删除。
我有需要的命名空间,所以它必须是语法,但是我不能为我的生活看看是什么问题是。
其他人可以吗?
Protected Sub Page_Load(ByVal sender As Object, ByVal e As
System.EventArgs)
[connection object creation]
Dim sSQL As String = "SELECT * FROM tPlayers"
Dim myAdapter As OleDbDataAdapter = New
OleDbDataAdapter(sSQL,myConnection)
Dim MyDataSet As New DataSet
myAdapter.Fill(MyDataSet)
GridView1.DataSource = MyDataSet
GridView1.DataBind()
myConnection.Close()
End Sub
I know the connection object is good because I use it else where, I have
edited out from the event above.
I have the require Namespaces , so it must be syntax, but I cannot for the
life of me see what the problem is.
Can anyone else?
命令对象在哪里。
" Paul W Smith" < pw*@NOSPAM.twelve.me.ukwrote in message
news:%2 **************** @ TK2MSFTNGP03.phx.gbl .. 。
Where is the command object.
"Paul W Smith" <pw*@NOSPAM.twelve.me.ukwrote in message
news:%2****************@TK2MSFTNGP03.phx.gbl...
受保护的子Page_Load(ByVal发送者为对象,ByVal e As
System.EventArgs)
[连接对象创建]
Dim sSQL As String =" SELECT * FROM tPlayers"
Dim myAdapter As OleDbDataAdapter = New
OleDbDataAdapter(sSQL,myConnection)
Dim MyDataSet As New DataSet
myAdapter.Fill(MyDataSet)
GridView1.DataSource = MyDataSet
GridView1.DataBind()
myConnection.Close()
End Sub
我知道连接对象很好,因为我在其他地方使用它,我有
从上面的事件中删除。
我有需要的命名空间,所以它必须是语法,但是我不能为我的生活看看是什么问题是。
其他人可以吗?
Protected Sub Page_Load(ByVal sender As Object, ByVal e As
System.EventArgs)
[connection object creation]
Dim sSQL As String = "SELECT * FROM tPlayers"
Dim myAdapter As OleDbDataAdapter = New
OleDbDataAdapter(sSQL,myConnection)
Dim MyDataSet As New DataSet
myAdapter.Fill(MyDataSet)
GridView1.DataSource = MyDataSet
GridView1.DataBind()
myConnection.Close()
End Sub
I know the connection object is good because I use it else where, I have
edited out from the event above.
I have the require Namespaces , so it must be syntax, but I cannot for the
life of me see what the problem is.
Can anyone else?
别介意命令对象,
>
你或者你没有收到语法错误。
语法错误是在运行时错误之前由编译器生成的。
你能来吗?找出你从MyDataSet.Tables.count得到的东西?
或MyDataSet.Tables [0] .Rows [0] .count
等...
Paul W Smith < pw*@NOSPAM.twelve.me.ukwrote in message
news:%2 **************** @ TK2MSFTNGP03.phx.gbl .. 。
Never mind command object,
Are you or are you not getting a Syntax error.
Syntax errors are generated by the complier before the runtime errors.
Can you findout what you get from MyDataSet.Tables.count?
or MyDataSet.Tables[0].Rows[0].count
etc...
"Paul W Smith" <pw*@NOSPAM.twelve.me.ukwrote in message
news:%2****************@TK2MSFTNGP03.phx.gbl...
受保护的子Page_Load(ByVal发送者为对象,ByVal e As
System.EventArgs)
[连接对象创建]
Dim sSQL As String =" SELECT * FROM tPlayers"
Dim myAdapter As OleDbDataAdapter = New
OleDbDataAdapter(sSQL,myConnection)
Dim MyDataSet As New DataSet
myAdapter.Fill(MyDataSet)
GridView1.DataSource = MyDataSet
GridView1.DataBind()
myConnection.Close()
End Sub
我知道连接对象很好,因为我在其他地方使用它,我有
从上面的事件中删除。
我有需要的命名空间,所以它必须是语法,但是我不能为我的生活看看是什么问题是。
其他人可以吗?
Protected Sub Page_Load(ByVal sender As Object, ByVal e As
System.EventArgs)
[connection object creation]
Dim sSQL As String = "SELECT * FROM tPlayers"
Dim myAdapter As OleDbDataAdapter = New
OleDbDataAdapter(sSQL,myConnection)
Dim MyDataSet As New DataSet
myAdapter.Fill(MyDataSet)
GridView1.DataSource = MyDataSet
GridView1.DataBind()
myConnection.Close()
End Sub
I know the connection object is good because I use it else where, I have
edited out from the event above.
I have the require Namespaces , so it must be syntax, but I cannot for the
life of me see what the problem is.
Can anyone else?
这篇关于DataGrid - 数据集的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!