13. oktober 2007 - 01:15
#2
hmmm ved ikke hvordan man gør det på den måde du foreslår,men dette kan vel gøres.
if not rs.eof then
arrRecords = rs.getrows()
end if
for i=0 to ubound(arrRecords,111)
response.write arrRecords(0,i)
response.write arrRecords(1,i)
response.write arrRecords(2,i)
response.write arrRecords(3,i)
etc...
next
måske, eller måske ikke. Hvad ved jeg:(
14. oktober 2007 - 15:08
#8
jeg er nået noget af vejen, men mangler lidt hjælp til det sidste:
if request.ServerVariables("REQUEST_METHOD") = "POST" then
dim arr0, arr1
For each X in Request.Form
if right(x,1) = "0" then
arr0 = arr0 & request.Form(x) & ";"
arr1 = arr1 & left(x,((len(x))-1)) & ";"
end if
next
arr0 = split(arr0,";")
arr1 = split(arr1,";")
rs_custom "SELECT * FROM EH101_status WHERE aircraft_id="&arr0(0),3,""
if not rs.eof then
rs( arr1(i) ) = arr0(i)
rs.update
end if
rs_end()
else ' post %>
linjen: rs( arr1(i) ) = arr0(i)
fejler med denne meddl: ADODB.Recordset (0x800A0CC1)
Item cannot be found in the collection corresponding to the requested name or ordinal.
hvilket tyder på at: rs( arr1(i) ) ikke er valid i sin syntax.
Hvordan gør jeg rs( arr1(i) ) valid?
Selve indholdet af arr1(i) er OK.
Normalt ser rs("navn på kolonne"), men jeg har lagt navnet ned i et array. Nu kan jeg ikke få "" omkring arrayet, så hvad gør jeg så?
15. oktober 2007 - 23:42
#10
løsningen er:
<body style="overflow:auto;" onunload="opener.location.reload(true);">
<%if mode = "flyvisupdate" then
if request.ServerVariables("REQUEST_METHOD") = "POST" then
dim arr0, arr1, arr2, arr3, arr4, arr5, arr6, arr7, arr8, arr9, arr10, arr11, arr12, arr13, arr14, arr15
For each X in Request.Form
if right(x,1) = "0" then
arr0 = arr0 & request.Form(x) & ";"
arr1 = arr1 & left(x,((len(x))-1)) & ";"
elseif right(x,1) = "1" then
arr2 = arr2 & request.Form(x) & ";"
arr3 = arr3 & left(x,((len(x))-1)) & ";"
elseif right(x,1) = "2" then
arr4 = arr4 & request.Form(x) & ";"
arr5 = arr5 & left(x,((len(x))-1)) & ";"
elseif right(x,1) = "3" then
arr6 = arr6 & request.Form(x) & ";"
arr7 = arr7 & left(x,((len(x))-1)) & ";"
elseif right(x,1) = "4" then
arr8 = arr8 & request.Form(x) & ";"
arr9 = arr9 & left(x,((len(x))-1)) & ";"
elseif right(x,1) = "5" then
arr10 = arr10 & request.Form(x) & ";"
arr11 = arr11 & left(x,((len(x))-1)) & ";"
elseif right(x,1) = "6" then
arr12 = arr12 & request.Form(x) & ";"
arr13 = arr13 & left(x,((len(x))-1)) & ";"
elseif right(x,1) = "7" then
arr14 = arr14 & request.Form(x) & ";"
arr15 = arr15 & left(x,((len(x))-1)) & ";"
end if
next
arr0 = split(arr0,";")
arr1 = split(arr1,";")
arr2 = split(arr2,";")
arr3 = split(arr3,";")
arr4 = split(arr4,";")
arr5 = split(arr5,";")
arr6 = split(arr6,";")
arr7 = split(arr7,";")
arr8 = split(arr8,";")
arr9 = split(arr9,";")
arr10 = split(arr10,";")
arr11 = split(arr11,";")
arr12 = split(arr12,";")
arr13 = split(arr13,";")
arr14 = split(arr14,";")
arr15 = split(arr15,";")
' e = 0
' for i = 0 to ubound(arr15)
' response.Write( e & ": " & arr15(i) & " = " & arr14(i) & "<br>" )
' e = e + 1
' next
' response.End()
rs_custom "SELECT * FROM EH101_status WHERE info1='"&arr0(30)&"'",3,""
On Error Resume Next ' fejlen ikke fundet men ligger i array arr0 eller arr1
if not rs.eof then
for i = 0 to ubound(arr1)
rs(arr1(i)) = arr0(i)
next
rs.update
end if
rs_end()
i = ""
rs_custom "SELECT * FROM EH101_status WHERE info1='"&arr2(40)&"'",3,""
On Error Resume Next ' fejlen ikke fundet men ligger i array arr0 eller arr1
if not rs.eof then
for i = 0 to ubound(arr3)
rs(arr3(i)) = arr2(i)
next
rs.update
end if
rs_end()
i = ""
rs_custom "SELECT * FROM EH101_status WHERE info1='"&arr4(0)&"'",3,""
On Error Resume Next ' fejlen ikke fundet men ligger i array arr0 eller arr1
if not rs.eof then
for i = 0 to ubound(arr5)
rs(arr5(i)) = arr4(i)
next
rs.update
end if
rs_end()
i = ""
rs_custom "SELECT * FROM EH101_status WHERE info1='"&arr6(52)&"'",3,""
On Error Resume Next ' fejlen ikke fundet men ligger i array arr0 eller arr1
if not rs.eof then
for i = 0 to ubound(arr7)
rs(arr7(i)) = arr6(i)
next
rs.update
end if
rs_end()
i = ""
rs_custom "SELECT * FROM EH101_status WHERE info1='"&arr8(62)&"'",3,""
On Error Resume Next ' fejlen ikke fundet men ligger i array arr0 eller arr1
if not rs.eof then
for i = 0 to ubound(arr9)
rs(arr9(i)) = arr8(i)
next
rs.update
end if
rs_end()
i = ""
rs_custom "SELECT * FROM EH101_status WHERE info1='"&arr10(72)&"'",3,""
On Error Resume Next ' fejlen ikke fundet men ligger i array arr0 eller arr1
if not rs.eof then
for i = 0 to ubound(arr11)
rs(arr11(i)) = arr10(i)
next
rs.update
end if
rs_end()
i = ""
rs_custom "SELECT * FROM EH101_status WHERE info1='"&arr12(82)&"'",3,""
On Error Resume Next ' fejlen ikke fundet men ligger i array arr0 eller arr1
if not rs.eof then
for i = 0 to ubound(arr13)
rs(arr13(i)) = arr12(i)
next
rs.update
end if
rs_end()
i = ""
rs_custom "SELECT * FROM EH101_status WHERE info1='"&arr14(92)&"'",3,""
On Error Resume Next ' fejlen ikke fundet men ligger i array arr0 eller arr1
if not rs.eof then
for i = 0 to ubound(arr15)
rs(arr15(i)) = arr14(i)
next
rs.update
end if
rs_end()
response.Redirect("default.asp?mode=flyvisupdate")
else ' post %>
<form action="default.asp?mode=flyvisupdate" method="post">
<input type="submit"><br>
<%rs_custom "SELECT * FROM EH101_status WHERE aircraft_id<>1",3,""
arrMitArray = rs.GetRows
rs_end()
for i=1 to Ubound(arrMitArray,1) ' arrMitArray(i,e)
response.Write("<br>")
for e=0 to Ubound(arrMitArray,2) %>
<input type="text" name="<%="info"&(i)&(e)%>" value="<%=arrMitArray(i,e)%>" class="input">
<%next
next%>
<%end if ' post
end if ' mode %>