Re: rs.Skipfirst??
From: Bob Barrows (reb01501_at_NOyahoo.SPAMcom)
Date: 02/25/04
- Next message: Phillip Windell: "Re: rs.Skipfirst??"
- Previous message: Phillip Windell: "Re: rs.Skipfirst??"
- In reply to: Bryan Harrington: "rs.Skipfirst??"
- Next in thread: Phillip Windell: "Re: rs.Skipfirst??"
- Messages sorted by: [ date ] [ thread ]
Date: Wed, 25 Feb 2004 11:06:48 -0500
Bryan Harrington wrote:
> Ok.. so I'm using a .CLASSIC Sub that basically returns a datagrid
> that is sortable and does paging. It's very handy since it's fairly
> generic in that I can pass it a SQL query and it populates the
> datagrid using the database field names as column headings.
>
> So.. my problem, I need the ID of record so I can pass it on the QS
> to an edit page, but I don't want to display it as the first column.
>
> Below is the snippet of code, and it does a for each field in
> RS.Fields... how do I say skip the first item in the collection?
>
> Thanks!
>
> 'display from the current record to the pagesize
> for i = intCurrentRecord to RS.PageSize
> if not RS.eof then
> Response.Write "<tr>" & vbcrlf
>
> 'for each field in the recordset
> for each field in RS.Fields
> Response.Write "<td>" & vbcrlf
>
> 'if this field is the "linked field" provide a link
> if lcase(strLinkedColumnName) = lcase(field.name) then
> Response.Write "<a href=" & strLink & rs("id") & ">" & field.value
> & "</a>" & vbcrlf
> else
> Response.Write field.value
> end if
> Response.Write "<td>" & vbcrlf
> next
> Response.Write "<tr>" & vbcrlf
> RS.MoveNext
> end if
> next
Two choices:
for each field in RS.Fields
If field.name <> "ID" ' or whatever the name of it is
'do the write
end if
next
or
for iCol = 1 to RS.Fields.count - 1
set field=RS.Fields(iCol)
'etc.
next
HTH,
Bob Barrows
PS. You should not use the word "field" as a variable name - avoid names of
intrinsic objects when naming your variables - I usually use "fld"
-- Microsoft MVP - ASP/ASP.NET Please reply to the newsgroup. This email account is my spam trap so I don't check it very often. If you must reply off-line, then remove the "NO SPAM"
- Next message: Phillip Windell: "Re: rs.Skipfirst??"
- Previous message: Phillip Windell: "Re: rs.Skipfirst??"
- In reply to: Bryan Harrington: "rs.Skipfirst??"
- Next in thread: Phillip Windell: "Re: rs.Skipfirst??"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|