·请教ASP编程高手。一个对你来说简单的问题,请务必要帮忙呀

来源:百度知道 编辑:UC知道 时间:2024/05/17 22:36:55
麻烦请问:
我做了一个函数。使用功能是:批量输入。
如下 :
functon produce()
dim product(10,2)
dim i
i=-1
i=i+1
if i<=10 then
product(i,0)=i
product(i,1)=i
product(i,2)=i,
end if
end function
现在我想把这个数组里面的东西逐条录入数据库。
不知道应该怎么做。

不懂你写的什么·~

我假定你已经连接了数据库,连接名称为conn,要写入的表名为"db1",字段为"c1"。程序我给你修改一下
functon produce()
dim product(10,2)
dim i
i=-1
do
i=i+1
if i<=10 then
product(i,0)=i
product(i,1)=i
product(i,2)=i
end if
loop
'set rs=system.createobject("adodb.recordset")
'rs.open conn,1,3
for i=0 to 10
strsql="insert into db1(c1) values(" & product(i,0) & ")"
conn.execute strsql
strsql="insert into db1(c1) values(" & product(i,1) & ")"
conn.execute strsql
strsql="insert into db1(c1) values(" & product(i,2) & ")"
conn.execute strsql
next

end function

dim product(10,2) 数组不能这样写的,晕,,,

Dim product,i
product = Array(10,2)
i=-1
do
i=i+1
if i<=10 then
product(i,0)=i ,这几句看不出你想做什么动作,,,猜不出来。。
product(i,1)=i
product(i,2)=i
en