Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

LOOP BUT GET COLUMN AND DAT INFORMATION FIRST

Status
Not open for further replies.

gsc123

Programmer
Jan 24, 2008
197
Hello,

I have a script that updates on certian fields, the problem is, for how many require updating I need to create that many rows before I update so i have the predefined row information, is there any way to get that single row of duplicated information then run my update to the size of the rows required, ie: I define how many rows I need?

I use this firstly to get how many rows and its data set

for each x in rs.Fields
arrColumn(i) = x.name
i = i + 1
Next


'then update ....

do until rs.EOF
i=0
for each x in rs.Fields
select case (i)
case 4
%><TD><%
'str = x.value&" "& Replace(UCASE(arr(j)),"JPG","") 'APPEND DESC
str = Replace(UCASE(arr(j)),"JPG","") 'APPEND DESC
sql = "update "&csv&" set "&csv&"."&arrColumn(i)&" = '"&str&"' where id = "&rs.Fields(0).Value
Response.Write sql&"<br>"
rs2.Open connstring
rs2.Execute(sql)
rs2.Close
if err.number <> 0 then
Response.Write err.Description
end if
sql=""
case 7
%><TD><%
'str = x.value&" "& Replace(UCASE(arr(j)),"JPG","") 'APPEND DESC
str = Replace(UCASE(arr(j)),"JPG","")
'str = Replace(str," ","-")
str = str & "<br><A href="" &" "" target=blank><IMG title="&arr(j) &" height="&sizeimg&" src="" &" "" width="&sizeimg&"></A></br>"
'Response.Write str
sql = "update "&csv&" set "&csv&"."&arrColumn(i)&" = '"&str&"' where "&csv&".id = "&rs.Fields(0).Value
Response.Write sql&"<br>"
rs2.Open connstring
rs2.Execute(sql)
rs2.Close
if err.number <> 0 then
Response.Write err.Description
end if
case else
%><TD><%Response.Write (x.value)
end select

i = i + 1
%></TD>
<%next
str = ""
rs.MoveNext
j = j + 1
%></BR></TR>
<%loop%>
</TABLE><%
 
Sorry this is required, an aray of files from a folder

for each file in f.files
arr(i) = file.name
i = i + 1
next
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top