p2p.wrox.com Forums

Need to download code?

View our list of code downloads.


  Return to Index  

proasp_codeclinic thread: Problems with SQL and Database


Message #1 by "Bob" <bobage24@a...> on Mon, 18 Sep 2000 18:36:31 +0100
you should out put the strComments not rsComments as you assigned the value
of rsBids("comments") to strComments

so replace that line with

response.write strComments

p

-----Original Message-----
From: Bob [mailto:bobage24@a...]
Sent: 18 September 2000 18:37
To: Code Clinic
Subject: [proasp_codeclinic] Problems with SQL and Database


Hello,
I am trying to create a connection with a database and output some data. I
am having trouble outputting the data. Here is the code:

' I know that the dabase is working, because the If Then statment is
working. I just cant figure out how to get the strComment back to the page
so all of the comments are displayed for the user.

Thanks in advance,
Bob

 Dim rsBids, strComments
  Set rsBids = Server.CreateObject("ADODB.Recordset")
  strSQL = "SELECT * FROM Comments WHERE ID =" & Request("Gym")
  rsBids.Open strSQL, objConn
  strComments = rsBids("Comments")
  Response.Write rsComments        ' This has no effect on the page, it  
writes nothing
%>


<CENTER><H1>The Gym Directory<BR>Adding comments to <%= strItemName
%></H1></CENTER>
<P>
<%
 If rsBids.EOF Then
    Response.Write "So far, no comments have been added."
  Else
    Response.Write _
      "<TABLE BORDER=""2"" WIDTH=100% CELLSPACING=""3"">" & _
      "<TR>" & _
      "  <TH>Comments:</TH>" & _
      "</TR>"
  Do While Not rsBids.EOF
      Response.Write _
      "<TR>" & _
      " <TD" & rsBids("Comments") & "</TD>" & _
      "</TR>"
      rsBids.MoveNext
    Loop
    rsBids.Close
    Response.Write "</TABLE>"
    Set rsBids = Nothing
    End If
 
%>




  Return to Index