将数据添加到记录集 [英] Adding data to a recordset

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

问题描述

在将数据添加到记录集时,我使用类似


rst的东西![Plot1] =某个变量

rst![Plot2] = some变量

......

rst![Plot99] =一些变量

rst![Plot1],rst![Plot2]手动输入等等,并且输入很多这些内容很繁琐。


如果有某种方法可以使用循环来设置字段名称?类似


x = 1到99

![Plotx] =某个变量(x)

next x

While adding data to a record set, I use something like

rst![Plot1] = some variable
rst![Plot2] = some variable
......
rst![Plot99] = some variable
The rst![Plot1] , rst![Plot2] etc. are manually typed in and it gets
tedious typing a lot of these.

If there some way to use a loop to setup the field names? Something like

For x = 1 to 99

rst![Plotx] = some variable(x)

next x

推荐答案

你需要一些像

x = 1到99

rst(" Plot"& x)=某个变量(x)

next x


Arno R

Karl Irvin < 88 ******** @ comcast.net> schreef在bericht新闻:qN ****************************** @ comcast.com。 ..
You need someting like
For x = 1 to 99
rst("Plot" & x) = some variable(x)
next x

Arno R
"Karl Irvin" <88********@comcast.net> schreef in bericht news:qN******************************@comcast.com. ..
在将数据添加到记录集时,我使用类似
的第一个![Plot1] =某个变量
rst![Plot2] =一些变量
.....
rst![Plot99] =一些变量

第一个![Plot1],rst![Plot2]等都是手动输入的并且很难输入很多这些。

如果有某种方法可以使用循环来设置字段名称?有点像

对于x = 1到99
rst![Plotx] =一些变量(x)

下一个x
While adding data to a record set, I use something like

rst![Plot1] = some variable
rst![Plot2] = some variable
.....
rst![Plot99] = some variable


The rst![Plot1] , rst![Plot2] etc. are manually typed in and it gets
tedious typing a lot of these.

If there some way to use a loop to setup the field names? Something like

For x = 1 to 99

rst![Plotx] = some variable(x)

next x



大多数聪明的开发人员不会使用记录集来更新数据。


如果必须,他们会使用现代版本的Access和ADO在


Recordset.Update aFields,aValues


其中aFields是字段名称或序数的变体数组aValues

是一系列惊喜价值的变种。


例如航空代码


Dim aFields(20 )作为变体

将aValues变暗为变体

Dim Iterator as Long


对于z = 0到19

aFields(z)= z

下一页z


rst.Update aFields,Array(12," John",20.66 ......等)很遗憾,CDMA的标准是陈旧而笨拙的DAO。

Most clever developers would not use a recordset for updating data.

If they had to they would use a modern version of Access and ADO as in

Recordset.Update aFields, aValues

where aFields is a variant array of field names or ordinals and aValues
is a variant array of, surprise, values.

eg Air Code

Dim aFields(20) as Variant
Dim aValues as Variant
Dim Iterator as Long

For z = 0 to 19
aFields(z) = z
Next z

rst.Update aFields, Array(12, "John", 20.66 ... etc )

Unfortunately the norm for CDMA is the archaic and clumsy DAO.


" Lyle Fairfield"         < LY *********** @ aim.com>写在

新闻:11 ********************** @ e56g2000cwe.googlegr psps.com:
"Lyle Fairfield" <ly***********@aim.com> wrote in
news:11**********************@e56g2000cwe.googlegr oups.com:
大多数聪明的开发人员不会使用记录集来更新数据。

现在你开始听起来像我们的好朋友史蒂夫。

如果他们不得不使用现代版本的Access和
ADO,如Recordset.Update aFields,aValues

其中aFields是字段名称的变体数组或者序数
和aValues是一系列惊喜值的变体。

例如空气代码

将aFields(20)变为变体
Dim aValues作为Variant
Dim Iterator as long

对于z = 0到19
aFields(z)= z
下一个z

rst。更新aFields,Array(12," John",20.66 ......等)


你可以在DAO中做一些非常相似的事情,比如

for z = 0到19

rst.fields(z)= myArray(z)

next z
不幸的是,CDMA的标准是过时且笨拙的DAO。
Most clever developers would not use a recordset for updating
data.
Now you are starting to sound like our good friend Steve.
If they had to they would use a modern version of Access and
ADO as in

Recordset.Update aFields, aValues

where aFields is a variant array of field names or ordinals
and aValues is a variant array of, surprise, values.

eg Air Code

Dim aFields(20) as Variant
Dim aValues as Variant
Dim Iterator as Long

For z = 0 to 19
aFields(z) = z
Next z

rst.Update aFields, Array(12, "John", 20.66 ... etc )
you can do something very similar in DAO, like
for z =0 to 19
rst.fields(z) = myArray(z)
next z
Unfortunately the norm for CDMA is the archaic and clumsy DAO.



它根本不笨拙。你只是一个脾气暴躁的老人。


-

Bob Quintal


PA是你我是我改变了我的电子邮件地址。


It''s not clumsy at all. You are just a Grumpy Old Man.

--
Bob Quintal

PA is y I''ve altered my email address.


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

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