急!!!ASP数据库取数据存入数组

2025-01-07 07:32:59
推荐回答(2个)
回答1:

'假设你的CONNECTION对象变量为conn

dim a,b()
dim l,lu
strData=Trim(request.Form("textname"))
a=split(request.Form("textname"),",")
lu=ubound(a)
redim b(lu)

for l=0 to lu
a(l)=trim(a(l))
b(l)="无此信息"
Next

strData=replace(strData,", ",",")
strData=replace(strData," ,",",")
strData="'" & replace(strData,",","','") & "'"

strSql="SELECT * FROM 数据表 WHERE K in (" & strData & ")"
set rs=Server.CreateObject("ADODB.RecordSet")
rs.open strSql,conn,1,1

while not rs.eof
strData=rs("K")
for l=0 to lu
if strData=a(l) then
if Not (rs("F")="" or isnull(rs("F"))) then b(l)=rs("F")
exit for
end if
next

rs.movenext
wend
rs.close
set rs=nothing

'数组a,b分别存放满足你要求的数据

回答2:

你思路不清,帮不到你了