如何在数据集中设置当前行 [英] How do you set the current row in a dataset

查看:81
本文介绍了如何在数据集中设置当前行的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何设置数据集的当前行?

我想将控件绑定到数据集中第5行的字段。

我填写数据集,然后我想将行设置为第5行,然后执行数据绑定。


Dataset1.tblMyTable.CurrentIndex = 5或类似的东西也许?


''使用索引号设置字段的值......

Dataset1.tblMyTable(1).FieldName = strName


''迭代数据集的行,但没有明确地设置行

......

For Each myRow In DataSet1.tblMyTable.Rows

strName = myRow(" FieldName")

Next

解决方案

创建一个只包含您要显示的行的DataView,然后将您的控件绑定到DataView。


Eliyahu


" Craig" <无**** @ austin.rr.com>在消息中写道

新闻:O0 ************** @ TK2MSFTNGP10.phx.gbl ...

你如何设置数据集的当前行?
我想将控件绑定到数据集中第5行的字段。
我填充数据集,然后我想将行设置为第5行然后执行
数据绑定。

Dataset1.tblMyTable.CurrentIndex = 5或类似的东西?

''使用索引号设置字段的值... ...
Dataset1.tblMyTable(1).FieldName = strName

''遍历数据集的行,但没有明确地设置行
......
对于DataSet1.tblMyTable.Rows中的每个myRow
strName = myRow(" FieldName")
下一页


我知道如何做到这一点,但它没有做我需要的。


我想要显示的行是基于索引的。或行号。我可能想要

显示第5行然后第100行然后第48行。所以我需要能够将当前的

行设置为5.


我该怎么做?

Dataset1.tblMyTable.CurrentIndex = 5或类似的东西?


" Eliyahu Goldin" <再************* @ monarchmed.com>在消息中写道

news:uf ************** @ tk2msftngp13.phx.gbl ...

制作一个DataView即可仅包含您要显示的行并将您的控件绑定到DataView。

Eliyahu

Craig <无**** @ austin.rr.com>在消息中写道
新闻:O0 ************** @ TK2MSFTNGP10.phx.gbl ...

如何设置当前行数据集?
我想将控件绑定到数据集中第5行的字段。
我填充数据集,然后我想将行设置为第5行然后
do数据绑定。

Dataset1.tblMyTable.CurrentIndex = 5或类似的东西?

''使用索引号设置字段的值......
Dataset1.tblMyTable(1).FieldName = strName

''遍历数据集的行,但没有明确地设置行
对于每个myRow In DataSet1.tblMyTable.Rows
strName = myRow(" FieldName")
下一页




Dataset1.tblMyTable.Rows [5]或Dataset1.tblMyTable [5]


这就是你追求的目标吗?


Eliyahu


" Craig" <无**** @ austin.rr.com>在留言中写道

新闻:uI ************** @ TK2MSFTNGP11.phx.gbl ...

我明白该怎么做那但它没有做我需要的。

我要展示的行是基于索引的。或行号。我可能希望
显示第5行然后第100行然后第48行。所以我需要能够将
当前行设置为5.

我该怎么做?
Dataset1.tblMyTable.CurrentIndex = 5或类似的东西?

Eliyahu Goldin <再************* @ monarchmed.com>在消息中写道
新闻:uf ************** @ tk2msftngp13.phx.gbl ...

创建一个只包含行的DataView你想要显示并将你的控件绑定到DataView。

Eliyahu

Craig <无**** @ austin.rr.com>在消息中写道
新闻:O0 ************** @ TK2MSFTNGP10.phx.gbl ...

如何设置当前行数据集?
我想将控件绑定到数据集中第5行的字段。
我填充数据集,然后我想将行设置为第5行,然后进行数据绑定。 br />
Dataset1.tblMyTable.CurrentIndex = 5或类似的东西?

''使用索引号设置字段的值......
数据集1 .tblMyTable(1).FieldName = strName

''遍历数据集的行但是没有明确地设置行
对于每个myRow In DataSet1.tblMyTable.Rows
strName = myRow(" FieldName")
下一页




How do you set the current row of a dataset?
I want to bind a control to a field from the 5th row in a dataset.
I fill the dataset, then I want to set the row to the 5th row and then do
the databinding.

Dataset1.tblMyTable.CurrentIndex = 5 or something like that maybe?

''Sets the value for a field using index number......
Dataset1.tblMyTable(1).FieldName = strName

''Iterates through rows of a dataset but does not set the row
explicitly......
For Each myRow In DataSet1.tblMyTable.Rows
strName = myRow("FieldName")
Next

解决方案

Make a DataView that will contain only the row you want to show and bind
your control to the DataView.

Eliyahu

"Craig" <no****@austin.rr.com> wrote in message
news:O0**************@TK2MSFTNGP10.phx.gbl...

How do you set the current row of a dataset?
I want to bind a control to a field from the 5th row in a dataset.
I fill the dataset, then I want to set the row to the 5th row and then do
the databinding.

Dataset1.tblMyTable.CurrentIndex = 5 or something like that maybe?

''Sets the value for a field using index number......
Dataset1.tblMyTable(1).FieldName = strName

''Iterates through rows of a dataset but does not set the row
explicitly......
For Each myRow In DataSet1.tblMyTable.Rows
strName = myRow("FieldName")
Next



I understand how to do that but it does not do what I need.

The row I want to show is based on the "index" or row number. I may want to
show row 5 then row 100 then row 48. So I need to be able to set the current
row to 5.

How do I do that?
Dataset1.tblMyTable.CurrentIndex = 5 or something like that maybe?

"Eliyahu Goldin" <re*************@monarchmed.com> wrote in message
news:uf**************@tk2msftngp13.phx.gbl...

Make a DataView that will contain only the row you want to show and bind
your control to the DataView.

Eliyahu

"Craig" <no****@austin.rr.com> wrote in message
news:O0**************@TK2MSFTNGP10.phx.gbl...

How do you set the current row of a dataset?
I want to bind a control to a field from the 5th row in a dataset.
I fill the dataset, then I want to set the row to the 5th row and then do the databinding.

Dataset1.tblMyTable.CurrentIndex = 5 or something like that maybe?

''Sets the value for a field using index number......
Dataset1.tblMyTable(1).FieldName = strName

''Iterates through rows of a dataset but does not set the row
explicitly......
For Each myRow In DataSet1.tblMyTable.Rows
strName = myRow("FieldName")
Next




Dataset1.tblMyTable.Rows[5] or Dataset1.tblMyTable[5]

Is that what you are after?

Eliyahu

"Craig" <no****@austin.rr.com> wrote in message
news:uI**************@TK2MSFTNGP11.phx.gbl...

I understand how to do that but it does not do what I need.

The row I want to show is based on the "index" or row number. I may want to show row 5 then row 100 then row 48. So I need to be able to set the current row to 5.

How do I do that?
Dataset1.tblMyTable.CurrentIndex = 5 or something like that maybe?

"Eliyahu Goldin" <re*************@monarchmed.com> wrote in message
news:uf**************@tk2msftngp13.phx.gbl...

Make a DataView that will contain only the row you want to show and bind
your control to the DataView.

Eliyahu

"Craig" <no****@austin.rr.com> wrote in message
news:O0**************@TK2MSFTNGP10.phx.gbl...

How do you set the current row of a dataset?
I want to bind a control to a field from the 5th row in a dataset.
I fill the dataset, then I want to set the row to the 5th row and then do the databinding.

Dataset1.tblMyTable.CurrentIndex = 5 or something like that maybe?

''Sets the value for a field using index number......
Dataset1.tblMyTable(1).FieldName = strName

''Iterates through rows of a dataset but does not set the row
explicitly......
For Each myRow In DataSet1.tblMyTable.Rows
strName = myRow("FieldName")
Next





这篇关于如何在数据集中设置当前行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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