sub

Results 1 to 4 of 4

Thread: sub

  1. #1
    Ricardo Rocha Guest

    Default sub

    I&#039m asking if i can do this on asp... I&#039m trying to create a recorset in a<BR>sub!!<BR><BR>&#060;%<BR>Set Conn = Server.CreateObject("ADODB.Connection")<BR>Conn.Op en "fcporto", "sa", ""<BR>Set rs = Conn.Execute("Select * FROM forum WHERE idmae=0 ORDER BY data<BR>DESC")<BR><BR>forum(rs)<BR><BR>sub forum(rsforum)<BR>while not rsforum.EOF<BR> Response.Write rsforum("titulo") & "<BR>"<BR> Set rstemp = Conn.Execute("Select * FROM forum WHERE idmae=" &<BR>rsforum("id") & " ORDER BY data DESC")<BR> if not rstemp.EOF then<BR> forum(rstemp)<BR> end if<BR> rsforum.Movenext<BR>wend<BR>end sub<BR><BR>%&#062;<BR>

  2. #2
    Join Date
    Dec 1969
    Posts
    569

    Default RE: sub

    Yes, but you must declare rs & rsforum as RecordSets:<BR><BR>Set rs = Server.CreateObject("ADODB.RecordSet")<BR>Set rsforum = Server.CreateObject("ADODB.RecordSet")

  3. #3
    Ricardo Rocha Guest

    Default RE: sub

    But rsforum is an argument of the function...<BR>Here&#039s the error i get:<BR><BR>ADODB.Fields error &#039 800a0cc1&#039 <BR><BR>ADO could not find the object in the collection corresponding to the name or ordinal reference requested by the application. <BR>

  4. #4
    Join Date
    Dec 1969
    Posts
    569

    Default RE: sub

    I think the Error you are receiving has to do with the Ordinal Name ( rsforum("Ordinal Name") ) not matching the column name on the table.<BR><BR>I have a very similar function that I use to dymnamically create a Select Box, and it works fine. <BR><BR>Public Function GenSelBox(rsInput)<BR><BR>Dim oOptions<BR> <BR>&#039 LOOP THRU THE RECORDSET, AND INSERT ITS CONTENTS INTO THE<BR>&#039 LIST BOX UNTIL THE RECORDSET IS EMPTY<BR>rsInput.MoveFirst<BR>Do Until rsInput.EOF<BR>oOptions = oOptions & "&#060;OPTION VALUE=" & RTrim( rsInput.Fields(0) ) & "&#062;" & RTrim( rsInput.Fields(1) )<BR>rsInput.MoveNext<BR>Loop<BR> <BR>GenSelBox = oOptions<BR> <BR>End Function<BR>


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •