Click to See Complete Forum and Search --> : printing db pulled record values


catchup
07-29-2003, 03:01 PM
Hello,

I'm need to post to another asp and i'm using:
<%Response.Write "<input type=""hidden"" name=""a1"" value='" & Trim(rs("a1")) & "'>"%>

a1 is one of 120 fields. For evey field i'm currently doing like so:

<%IF Trim(rs("a1")) > "" THEN%><li><font face="Verdana" size="1">&nbsp;<%=Trim(rs("a1"))%></font></li>
<%Response.Write "<input type=""hidden"" name=""a1"" value='" & Trim(rs("a1")) & "'>"%><%END IF%>

I was wondering if i could somehow have a loop that i can put in the between the form tags that will do this for every field? something like so:
<%
For Each thing In rs
Response.Write "<input type=""hidden"" name=""" & thing & """ value=""" & rs(thing) & """>" & vbCrLf
Next
%>

CrazyGaz
07-29-2003, 07:54 PM
try

<% while not RS.EOF %>
<input type="hidden" name="<%=RS("FIELD NAME")%>" value="<%=trim(RS("FIELD NAME"))%>">
<% RS.MOVENEXT
wend %>

catchup
07-30-2003, 11:00 AM
yes i tried it and the objects can not be used it that way error appeared, i think i'm on to it:

do while not rs.eof
for each fld in rs.fields
if trim(fld.value & "") <> "" then
response.write "<input type='hidden' name='" & fld.name & "' id='" & fld_name & "' value='" & trim(fld.value & "") & "'>" & vbcrlf
end if
next
rs.movenext
loop