Me Again (Field only shows on the page once)

Results 1 to 2 of 2

Thread: Me Again (Field only shows on the page once)

  1. #1
    Jim Davies Guest

    Default Me Again (Field only shows on the page once)

    -------------------------<BR><BR>I originally posted this:<BR><BR>-------------------------<BR><BR>I have never had this problem before:<BR><BR>Works Great:<BR><BR>&#060;%=RS.Fields("NAME")%&#062;<BR> <BR>But this will not work:<BR>1: &#060;%=RS.Fields("NAME")%&#062;<BR>&#060;p&#062;< BR>2: &#060;%=RS.Fields("NAME")%&#062;<BR><BR>Shows up us:<BR><BR>1: Jim<BR><BR>2: <BR><BR><BR>I had one field on the top of the page then used it again near the bottom; I figured I was doing something wrong in between the code. So I wrote them right next to each other, like in my example, and nothing on the second instance, empty.<BR><BR><BR><BR>-------------------------<BR><BR>Here is my update, as requested by everyone:<BR><BR>-------------------------<BR><BR><BR><BR>&#060;%<BR><BR>myDSN="DSN=Document Center;pwd=abcdef"<BR>set tmpconn=Server.CreateObject("ADODB.Connection")<BR >tmpconn.Open myDSN<BR><BR><BR>sql= "select * FROM theitems WHERE itemid="&Request.QueryString("itemid")<BR>set RS = tmpconn.Execute(sql)<BR>%&#062;<BR><BR><BR>&#060;% if not RS.EOF then%&#062;<BR>&#060;H1&#062;&#060;%=RS.Fields("is sue")%&#062;&#060;/H1&#062; &#060;--- OK<BR><BR><BR>Issue:<BR><BR>&#060;%=RS.Fields("iss ue")%&#062; &#060;--------NOT SHOWING (second call)<BR><BR>Topic:<BR><BR>&#060;%=RS.Fields("topi c")%&#062; &#060;--- OK<BR><BR><BR><BR>&#060;%end if%&#062;<BR><BR><BR>&#060;%<BR>RS.close<BR>tmpcon n.Close<BR>set tmpconn= nothing<BR>%&#062;<BR><BR><BR><BR>Bottom Line I can only call a field once.<BR><BR>Also, I have notice that every other Script I have written, works fine, I also notice something strange about this one.<BR><BR>When I attempt to open the table in Access, access pauses a long time before it will let me open the table.<BR><BR>Also, if I have the database open in Access and try to run the ASP, the script crashes, this too is not happening in any other databases. I have looked at all the code on the scripts but they all seem to be the same, this one is just reacting different. <BR><BR>I am totally confused--<BR><BR>Thanks In advance!

  2. #2
    Scott S Guest

    Default RE: Me Again (Field only shows on the page once)

    Why not save all the fields to a local variable before doing anything with them?<BR><BR>Dim strFieldName &#039As String <BR><BR>strFieldName = obj_RS("SOMEFIELD") &#039Assignment<BR><BR>from there you can use strFieldName all you want. Its also more efficent to do it this way, you only have to hit your recordset object once as opposed to twice in the previous code.<BR><BR>This would present a fix or workaround to your problem but I do not know why you wouldn&#039t be able to use the field twice.<BR><BR>Perhaps its some quirk in the fields collection. <BR><BR>Hope that helps.<BR><BR>Scott S

Posting Permissions

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