且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

DataGrid - 数据集

更新时间:2023-12-06 17:07:16




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?