p2p.wrox.com Forums

Need to download code?

View our list of code downloads.


  Return to Index  

asp_components thread: Problem with VB6 Web Programming ( Update )


Message #1 by David Hamill <david.hamill@p...> on Thu, 15 Mar 2001 09:29:54 -0000

On further inspection I have found that my 'pubs' database in sql 7 does not

include the following fields 'pubdate' & 'title'.



I have modified my code to include the following...sadly I continue to

recieve the same error message.



 'Build the order by clause based on request.form("AuthorOption")

   Select Case CInt(m_Request.Form("AuthorOption"))

      Case 0

         strOrderBy = "order by au_lname"

      Case 1

         strOrderBy = "order by au_fname"

      Case 2

         strOrderBy = "order by city"

      Case Else

         strOrderBy = ""

   End Select



   'Set the SQL string

      strSQL = "select au_lname, au_fname, city, state " & _

      "From authors " & _

      strOrderBy

   

   On Error GoTo SQLErr

   'Set the cursorlocation

   m_objRs.CursorLocation = adUseClient

   'Open the recordset

   m_objRs.Open strSQL, m_objConn, adOpenForwardOnly, , adCmdText

   'Set the recordset to no active connection

   Set m_objRs.ActiveConnection = Nothing

   On Error GoTo 0

   

   'Close the database to free the connection

   Call CloseDatabase

   

   'Build the first part of the table containing all header information

   m_Response.Write "<table border=""1""><tr>"

   m_Response.Write "<th nowrap bgcolor=""#800000""><font

color=""#FFFFFF"">" & _

      "Last Name</font></th>"

   m_Response.Write "<th nowrap bgcolor=""#800000""><font

color=""#FFFFFF"">" & _

      "First Name</font></th>"

   m_Response.Write "<th nowrap bgcolor=""#800000""><font

color=""#FFFFFF"">" & _

      "City</font></th>"

   m_Response.Write "<th nowrap bgcolor=""#800000""><font

color=""#FFFFFF"">" & _

      "State</font></th>"

  

   m_Response.Write "</tr>"

   

   'Loop through the recordset building each row of the table

   Do While Not m_objRs.EOF

      intCount = intCount + 1

      m_Response.Write "<tr>"

      m_Response.Write "<td bgcolor=""#C0C0C0"">" & m_objRs!au_lname & _

         "</td>"

      m_Response.Write "<td bgcolor=""#C0C0C0"">" & m_objRs!au_fname & _

         "</td>"

      m_Response.Write "<td bgcolor=""#C0C0C0"">" & m_objRs!city & _

         "</td>"

      m_Response.Write "<td bgcolor=""#C0C0C0"">" & m_objRs!state & _

         "</td>"

      m_Response.Write "</tr>"

      m_objRs.MoveNext

   Loop

   

   'Build the last part of the table

   m_Response.Write "</table>"

   

   'Close the recordset

   Call CloseRecordset

   

   Exit Sub

   

SQLErr:

   m_Response.Write "<P><strong><font color=""#FF0000"">" & _

      "SQL Error Occurred Reading From The Database</font></strong><P>"

End Sub





David








  Return to Index