帮助数据网格 [英] Help with data grid

查看:88
本文介绍了帮助数据网格的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述




有人可以帮帮我吗?我还在学习vb所以这是相当的

新的。


我现在已经追了3天了这个问题而且我认为我是

准备放弃。有谁知道如何让我的数据网格显示在

一个标签控件上?我有一个标签控件,上面有2个标签,一个用于

数据网格,另一个用于评论。我尝试了一切。

我在这个标签上添加代码来显示数据网格吗?我有

代码和所有工作来填充数据适配器并从表中填充数据

网格但我不知道如何使其显示在标签

控制。这让我发疯,帮忙......谢谢


这是我的数据适配器代码:


Dim strOTRConnection As String =" ; Provider = Microsoft.Jet.OLEDB.4.0;

数据源= C:\otr.mdb"

Dim strSQLEpisode As String

Dim dtEpisode As New DataTable

Dim dgEpisodes As New DataGrid


dtEpisode.Clear()

strSQLEpisode =" SELECT *" ; &安培; _

" FROM Episode WHERE showcode =''" &安培; Me.txtCode.Text& "''"

Dim dataAdapter As New OleDb.OleDbDataAdapter(strSQLEpisode,

strOTRConnection)

dataAdapter.Fill(dtEpisode)

dataAdapter.Dispose()

Me.dgEpisodes.DataSource = dtEpisode

如你所见,我处理了代码中的所有内容,所以我没有构建一个

数据集或使用任何工具。刚刚添加了所有内容以连接数据

适配器代码。

谢谢


***通过Developersdex发送 http://www.developersdex.com ***

不要刚参加USENET ......获得奖励!



Can someone please help me? I am still learning vb so this is fairly
new.

I have been chasing this problem for 3 days now and I think that I am
ready to give up. Does anyone know how to make my data grid display on
a tab control? I have a tab control with 2 tabs on it, one for the
data grid and the other for comments. I have tried everything. Where
do I add the code to say display the data grid on this tab? I have the
code and everything working to fill the data adapter and fill the data
grid from the table but I don''t know how to make it display on the tab
control. This is driving me crazy, help...thanks

this is my code for the data adapter:

Dim strOTRConnection As String = "Provider=Microsoft.Jet.OLEDB.4.0;
Data Source= C:\otr.mdb"
Dim strSQLEpisode As String
Dim dtEpisode As New DataTable
Dim dgEpisodes As New DataGrid

dtEpisode.Clear()
strSQLEpisode = "SELECT * " & _
"FROM Episode WHERE showcode = ''" & Me.txtCode.Text & "'' "
Dim dataAdapter As New OleDb.OleDbDataAdapter (strSQLEpisode,
strOTRConnection)
dataAdapter.Fill(dtEpisode)
dataAdapter.Dispose()
Me.dgEpisodes.DataSource = dtEpisode
As you can see, I handled everything in code so I did not build a
dataset or used any tools. Just added everything to connect the data
adapter in code.
Thanks

*** Sent via Developersdex http://www.developersdex.com ***
Don''t just participate in USENET...get rewarded for it!

推荐答案




你确定吗?你在数据表中得到任何数据吗?

Debug.Writeline(dtEpisode.Rows.Count)会告诉你返回了多少行


< br $>
Ken

------------

金伯利威金斯 <き******** @ greenwaymedical.com>在消息中写道

新闻:%2 *************** @ TK2MSFTNGP11.phx.gbl ...
Hi,

Are you sure you are getting any data into the datatable ?
Debug.Writeline(dtEpisode.Rows.Count) will tell you how many rows are being
returned.

Ken
------------
"Kimberley Wiggins" <ki********@greenwaymedical.com> wrote in message
news:%2***************@TK2MSFTNGP11.phx.gbl...


有人可以帮帮我吗?我还在学习vb所以这是相当新的。

我一直在追问这个问题3天了,我想我已经准备好放弃了。有谁知道如何使我的数据网格显示在选项卡控件上?我有一个标签控件,上面有两个标签,一个用于
数据网格,另一个用于评论。我尝试了一切。我在哪里添加代码来说明在这个标签上显示数据网格?我有
代码和所有工作来填充数据适配器并从表中填充数据
网格但我不知道如何使它显示在选项卡
控件上。这让我发疯,帮忙......谢谢

这是我的数据适配器代码:

Dim strOTRConnection As String =" Provider = Microsoft.Jet.OLEDB .4.0;
数据源= C:\otr.mdb"
Dim strSQLEpisode As String
Dim dtEpisode As New DataTable
Dim dgEpisodes As New DataGrid

dtEpisode.Clear()
strSQLEpisode =" SELECT *" &安培; _
FROM Episode WHERE showcode =''" &安培; Me.txtCode.Text& "''"
Dim dataAdapter As New OleDb.OleDbDataAdapter(strSQLEpisode,
strOTRConnection)
dataAdapter.Fill(dtEpisode)
dataAdapter.Dispose()
我.dgEpisodes.DataSource = dtEpisode

如你所见,我处理了代码中的所有内容,因此我没有构建
数据集或使用任何工具。刚刚添加了所有内容以在代码中连接数据
适配器。
谢谢

***通过Developersdex发送 http://www.developersdex.com ***
不要只是参加USENET ......获得奖励!


Can someone please help me? I am still learning vb so this is fairly
new.

I have been chasing this problem for 3 days now and I think that I am
ready to give up. Does anyone know how to make my data grid display on
a tab control? I have a tab control with 2 tabs on it, one for the
data grid and the other for comments. I have tried everything. Where
do I add the code to say display the data grid on this tab? I have the
code and everything working to fill the data adapter and fill the data
grid from the table but I don''t know how to make it display on the tab
control. This is driving me crazy, help...thanks

this is my code for the data adapter:

Dim strOTRConnection As String = "Provider=Microsoft.Jet.OLEDB.4.0;
Data Source= C:\otr.mdb"
Dim strSQLEpisode As String
Dim dtEpisode As New DataTable
Dim dgEpisodes As New DataGrid

dtEpisode.Clear()
strSQLEpisode = "SELECT * " & _
"FROM Episode WHERE showcode = ''" & Me.txtCode.Text & "'' "
Dim dataAdapter As New OleDb.OleDbDataAdapter (strSQLEpisode,
strOTRConnection)
dataAdapter.Fill(dtEpisode)
dataAdapter.Dispose()
Me.dgEpisodes.DataSource = dtEpisode
As you can see, I handled everything in code so I did not build a
dataset or used any tools. Just added everything to connect the data
adapter in code.
Thanks

*** Sent via Developersdex http://www.developersdex.com ***
Don''t just participate in USENET...get rewarded for it!





是的,我确实尝试过,它确实显示我在数据表中获得了正确的行



***通过开发人员指南 http://www.developersdex.com发送 ***

不要只是参加USENET ......获得奖励!

Yes I did try that and it does show that I am getting the correct rows
into the datatable.
*** Sent via Developersdex http://www.developersdex.com ***
Don''t just participate in USENET...get rewarded for it!


嗨Kimberly,


奇怪的是因为我测试了你的代码(用另一个数据库)而且它是

显示了一个数据网格。


但是我没有什么可以添加到Kens的问题,因为我的本来就是

相同。


但现在我的下一个问题是, datagrid显示(空)?


Cor
Hi Kimberly,

It is strange becaus I tested your code (with another database) and it
showed a datagrid .

But I had nothing to add to Kens question, because mine would have been the
same.

But now my next question, is the datagrid showed (empty)?

Cor
是的我确实尝试过,它确实显示我正在获取正确的行
到数据表中。
Yes I did try that and it does show that I am getting the correct rows
into the datatable.



这篇关于帮助数据网格的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆