最接近VBA记录集的方法 [英] Closest method to a VBA recordset

查看:82
本文介绍了最接近VBA记录集的方法的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述




请记住,在VBA中,您可以轻松创建记录集,循环通过

行,并将列的值存储到变量...


我甚至不是在谈论回写数据......


在我看来,我可以使用仅转发datareader看来

将一整行数据存储到一个长字符串中,然后我必须使用一些解析方法来确定特定列的值

的数据。


或者......


我可以创建一个数据集这需要构建所有必需的

结构(列,行和表),然后我仍然必须通过它加载和

循环....


是否有一些更简单的方法可以简单地循环通过一个数据块并返回

我指定的列名的值?

Hi

Remember back in VBA, you could easily create a recordset, loop thru the
rows, and store the values of the columns to variables...

I am not even talking about writing back to the data...

It looks to me like I can use a forward only "datareader" which appears to
store a whole row of data into one long string, which I would then have to
use some parsing method in order to determine the value of a specific column
of data.

Or...

I could create a "dataset" which entails building all the required
structures (columns, rows, and tables) and then I still have to load and
loop thru it....

Is there some easier method to simply loop thru a block of data and return
the value of a column name I specifiy ?

推荐答案

" Rob" < ro *** @ yahoo.com写道

新闻:Ip **************************** **@comcast.com:
"Rob" <ro***@yahoo.comwrote in
news:Ip******************************@comcast.com:

在我看来,我只能使用前向datareader。

似乎将一整行数据存储到一个长字符串中,然后我将需要使用一些解析方法来确定

特定数据列的值。
It looks to me like I can use a forward only "datareader" which
appears to store a whole row of data into one long string, which I
would then have to use some parsing method in order to determine the
value of a specific column of data.



不,您可以通过以下方式访问各列:

DataReader(" ColumnName")或DataReader(ColumnIndex) )

No, you can access the individual columns by going:

DataReader("ColumnName") OR DataReader(ColumnIndex)


我可以创建一个数据集这需要构建所有必需的

结构(列,行和表),然后我仍然需要加载

并循环它....
I could create a "dataset" which entails building all the required
structures (columns, rows, and tables) and then I still have to load
and loop thru it....



或者只是数据表。

Or just the datatable.


是否有一些简单的方法可以简单地循环通过一个数据块和

返回我指定的列名的值?
Is there some easier method to simply loop thru a block of data and
return the value of a column name I specifiy ?



仔细看看DataReader和DataSet ;-)

Take a closer look at DataReader and DataSets ;-)


抱歉生活过去简单得多


现在你必须为每个datareader分开连接;你不能

重用一个真正的连接 - 因为ADO.net试图帮助

out并自动关闭任何连接_EVER_无缘无故


MS使用.NET搞砸了我们所有人;最好坚持使用VBA直到

新版本的Visual Fred即将发布

我最喜欢Access Data Projects



4月18日下午2:11,Rob < r ... @ yahoo.comwrote:
sorry life used to be much much simpler

now you''ve got to have a seperate connection per datareader; you can''t
reuse a connection for really anything-- because ADO.net tries to help
out and automagically close any connection _EVER_ for no reason

MS screwed us all with .NET; it is best to stick with VBA until the
new version of Visual Fred comes out soon
I love Access Data Projects more than anything


On Apr 18, 2:11 pm, "Rob" <r...@yahoo.comwrote:




请记住,回到VBA,您可以轻松创建一个记录集,循环通过

行,并将列的值存储到变量...


我甚至没有谈论写回数据...


在我看来,我只能使用前向datareader。看来

将一整行数据存储到一个长字符串中,然后我必须使用一些解析方法来确定特定列的值

的数据。


或者......


我可以创建一个数据集这需要构建所有必需的

结构(列,行和表),然后我仍然必须通过它加载和

循环....


是否有一些更简单的方法可以简单地循环通过一个数据块并返回

我指定的列名的值?
Hi

Remember back in VBA, you could easily create a recordset, loop thru the
rows, and store the values of the columns to variables...

I am not even talking about writing back to the data...

It looks to me like I can use a forward only "datareader" which appears to
store a whole row of data into one long string, which I would then have to
use some parsing method in order to determine the value of a specific column
of data.

Or...

I could create a "dataset" which entails building all the required
structures (columns, rows, and tables) and then I still have to load and
loop thru it....

Is there some easier method to simply loop thru a block of data and return
the value of a column name I specifiy ?



啊,我看到......


DataReader(" ColumnName")with a。.ToString添加确实工作


非常感谢!

Spam Catcher < sp ********** @ rogers.comwrote in message

news:Xn ******************** **************@127.0.0。 1 ...
Ahhh, I see...

DataReader("ColumnName") with a ".ToString" added does work fine

Thanks a Bunch !
"Spam Catcher" <sp**********@rogers.comwrote in message
news:Xn**********************************@127.0.0. 1...

" Rob" < ro *** @ yahoo.com写道

新闻:Ip **************************** **@comcast.com:
"Rob" <ro***@yahoo.comwrote in
news:Ip******************************@comcast.com:

>在我看来,我可以使用仅向前的datareader。
似乎将整行数据存储到一个长字符串中,然后我必须使用一些解析方法来确定特定数据列的值。
>It looks to me like I can use a forward only "datareader" which
appears to store a whole row of data into one long string, which I
would then have to use some parsing method in order to determine the
value of a specific column of data.



不,您可以通过以下方式访问各个列:


DataReader(" ColumnName")或DataReader(ColumnIndex) )


No, you can access the individual columns by going:

DataReader("ColumnName") OR DataReader(ColumnIndex)


>我可以创建一个数据集这需要构建所有必需的结构(列,行和表),然后我仍然需要加载
并通过它循环....
>I could create a "dataset" which entails building all the required
structures (columns, rows, and tables) and then I still have to load
and loop thru it....



或者只是数据表。


Or just the datatable.


>是否有一些更简单的方法可以简单地循环数据块并返回a的值列名我指定?
>Is there some easier method to simply loop thru a block of data and
return the value of a column name I specifiy ?



仔细看看DataReader和DataSet ;-)


Take a closer look at DataReader and DataSets ;-)



这篇关于最接近VBA记录集的方法的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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