2 Replies Latest reply on May 4, 2010 4:56 AM by awstam

    Recordsert not working using the GET method

    Brachole

      I'm trying to create a recordset that will retrieve a record from MSSQL.

       

      My recordset is like this:

       

      <%
      Dim rsAssets__MMColParam2
      rsAssets__MMColParam2 = "1"
      If (Request.QueryString("type") <> "") Then
        rsAssets__MMColParam2 = Request.QueryString("type")
      End If
      %>
      <%
      Dim rsAssets__MMColParam
      rsAssets__MMColParam = "1"
      If (Request.QueryString("number") <> "") Then
        rsAssets__MMColParam = Request.QueryString("number")
      End If
      %>
      <%
      Dim rsAssets
      Dim rsAssets_cmd
      Dim rsAssets_numRows

       

      Set rsAssets_cmd = Server.CreateObject ("ADODB.Command")
      rsAssets_cmd.ActiveConnection = MM_ezcaldatasource_STRING
      rsAssets_cmd.CommandText = "SELECT * FROM dbo.assets WHERE ? = ?"
      rsAssets_cmd.Prepared = true
      rsAssets_cmd.Parameters.Append rsAssets_cmd.CreateParameter("param1", 200, 1, 255, rsAssets__MMColParam2) ' adVarChar
      rsAssets_cmd.Parameters.Append rsAssets_cmd.CreateParameter("param2", 200, 1, 255, rsAssets__MMColParam) ' adVarChar

       

      Set rsAssets = rsAssets_cmd.Execute
      rsAssets_numRows = 0
      %>

       

       

      Thi s gives me a Server 500 error...if I just I only use 1 parameter, it works fine. Basically, MMColParam2 is a column in the database (either Asset or Serial) which comes from a field on my form.

        • 1. Re: Recordsert not working using the GET method
          bregent Most Valuable Participant

          >Thi s gives me a Server 500 error..

           

          Enable error reporting on your server to see details. Ask your host if you don't know how. Also be sure friendly error messages is disabled in your browser.

          • 2. Re: Recordsert not working using the GET method
            awstam

            try this

             

             

            Dim rsAssets
            Dim  rsAssets_cmd
            Dim rsAssets_numRows

             

            Set rsAssets_cmd =  Server.CreateObject ("ADODB.Command")

             

            rsAssets_cmd.ActiveConnection =  MM_ezcaldatasource_STRING

             

            rsAssets_cmd.CommandText = "SELECT * FROM  dbo.assets WHERE '"&request.querystring("type")&"' = '"&request.querystring("number")&"'"

             

            rsAssets_cmd.Prepared = true

             

             

            im thinking it has to do with either there being a blank value passed... or.. the "content type" is wrong