Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Web Development
  3. Calling stored procedure from ASP page.

Calling stored procedure from ASP page.

Scheduled Pinned Locked Moved Web Development
databasetutorialsql-serversysadminquestion
6 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • K Offline
    K Offline
    Kiran S S
    wrote on last edited by
    #1

    I have created a stored procedure in SQL Server 2005. I am trying to call that procedure from ASP (Classic asp) page. The stored procedure returns a recordset of this query.

    SELECT Count(worklist_P.wrkID) AS Total, Sum(CASE WHEN complited = 'True' then 1 else 0 end) AS [comp],
    Sum(Case when readed = 'False' then 1 else 0 end) AS new,
    Sum(Case When complited = 'False' then 1 else 0 end) AS pend
    FROM (employee_Master INNER JOIN worklist_C ON employee_Master.empID = worklist_C.assignedWhom)
    INNER JOIN worklist_P ON worklist_C.wrkID = worklist_P.wrkID WHERE (((worklist_C.assignedWhom)=@empId));

    I am calling that procedure in following code:

    set cmd = Server.CreateObject("ADODB.Command")
    cmd.ActiveConnection = con
    cmd.CommandText = "wrksCnt"
    cmd.CommandText = "{call wrksCnt(?)}"
    cmd.Parameters.Append cmd.CreateParameter("@empId", 3, 1)
    cmd.Parameters("@empId") = 2
    set rsWork = cmd.Execute()

    But it is not returning anything. I have tried executing above stored procedure in SQL Server 2005. It is running well. Giving proper output. I have also tried this code to strSql = "exec wrksCnt '" & Session("empID") & "'" set rsWork = con.Execute(strSql) This code is also not returning any value. Please guide how to call stored procedure properly in classic asp page.

    Kiran Sajanikar Software Engineer Pune, India

    Y K 4 Replies Last reply
    0
    • K Kiran S S

      I have created a stored procedure in SQL Server 2005. I am trying to call that procedure from ASP (Classic asp) page. The stored procedure returns a recordset of this query.

      SELECT Count(worklist_P.wrkID) AS Total, Sum(CASE WHEN complited = 'True' then 1 else 0 end) AS [comp],
      Sum(Case when readed = 'False' then 1 else 0 end) AS new,
      Sum(Case When complited = 'False' then 1 else 0 end) AS pend
      FROM (employee_Master INNER JOIN worklist_C ON employee_Master.empID = worklist_C.assignedWhom)
      INNER JOIN worklist_P ON worklist_C.wrkID = worklist_P.wrkID WHERE (((worklist_C.assignedWhom)=@empId));

      I am calling that procedure in following code:

      set cmd = Server.CreateObject("ADODB.Command")
      cmd.ActiveConnection = con
      cmd.CommandText = "wrksCnt"
      cmd.CommandText = "{call wrksCnt(?)}"
      cmd.Parameters.Append cmd.CreateParameter("@empId", 3, 1)
      cmd.Parameters("@empId") = 2
      set rsWork = cmd.Execute()

      But it is not returning anything. I have tried executing above stored procedure in SQL Server 2005. It is running well. Giving proper output. I have also tried this code to strSql = "exec wrksCnt '" & Session("empID") & "'" set rsWork = con.Execute(strSql) This code is also not returning any value. Please guide how to call stored procedure properly in classic asp page.

      Kiran Sajanikar Software Engineer Pune, India

      Y Offline
      Y Offline
      Yusuf
      wrote on last edited by
      #2

      you asked the same question, 3 posts down, I gave you a link, then you decided to delete your message and post it again. Sorry, that will not help.

      Yusuf Oh didn't you notice, analogous to square roots, they recently introduced rectangular, circular, and diamond roots to determine the size of the corresponding shapes when given the area. Luc Pattyn[^]

      K 1 Reply Last reply
      0
      • Y Yusuf

        you asked the same question, 3 posts down, I gave you a link, then you decided to delete your message and post it again. Sorry, that will not help.

        Yusuf Oh didn't you notice, analogous to square roots, they recently introduced rectangular, circular, and diamond roots to determine the size of the corresponding shapes when given the area. Luc Pattyn[^]

        K Offline
        K Offline
        Kiran S S
        wrote on last edited by
        #3

        I have gone through your reply. I found that I have alredy refferd that link before starting this thread. I have imergency for the solution. Thats why I did so. I extrimly sorry for that. But now could you please go through my post again and help me out detecting my bug to solve my problem.

        Kiran Sajanikar Software Engineer Pune, India

        1 Reply Last reply
        0
        • K Kiran S S

          I have created a stored procedure in SQL Server 2005. I am trying to call that procedure from ASP (Classic asp) page. The stored procedure returns a recordset of this query.

          SELECT Count(worklist_P.wrkID) AS Total, Sum(CASE WHEN complited = 'True' then 1 else 0 end) AS [comp],
          Sum(Case when readed = 'False' then 1 else 0 end) AS new,
          Sum(Case When complited = 'False' then 1 else 0 end) AS pend
          FROM (employee_Master INNER JOIN worklist_C ON employee_Master.empID = worklist_C.assignedWhom)
          INNER JOIN worklist_P ON worklist_C.wrkID = worklist_P.wrkID WHERE (((worklist_C.assignedWhom)=@empId));

          I am calling that procedure in following code:

          set cmd = Server.CreateObject("ADODB.Command")
          cmd.ActiveConnection = con
          cmd.CommandText = "wrksCnt"
          cmd.CommandText = "{call wrksCnt(?)}"
          cmd.Parameters.Append cmd.CreateParameter("@empId", 3, 1)
          cmd.Parameters("@empId") = 2
          set rsWork = cmd.Execute()

          But it is not returning anything. I have tried executing above stored procedure in SQL Server 2005. It is running well. Giving proper output. I have also tried this code to strSql = "exec wrksCnt '" & Session("empID") & "'" set rsWork = con.Execute(strSql) This code is also not returning any value. Please guide how to call stored procedure properly in classic asp page.

          Kiran Sajanikar Software Engineer Pune, India

          K Offline
          K Offline
          Kiran S S
          wrote on last edited by
          #4

          I have tried above code with different query. The recordset is returning -1 recordcount. I have tested both queries in Sql Sever 2005, They are running well and giving proper output. Then why the recordset is returning me -1 recordcount. New query is as below :

          strSql = "SELECT TOP (50) MAX(feedback.replyID) AS replyID, feedback.wrkID, MAX(feedback.feedback) AS feedback, MAX(employee_Master.empName) AS empName, " & _
          "MAX(feedback.replydate) AS replydate, feedback.empID, worklist_C.complited " & _
          "FROM employee_Master INNER JOIN " & _
          "worklist_P INNER JOIN " & _
          "feedback ON worklist_P.wrkID = feedback.wrkID ON employee_Master.empID = feedback.empID INNER JOIN " & _
          "worklist_C ON worklist_P.wrkID = worklist_C.wrkID AND employee_Master.empID = worklist_C.assignedWhom " & _
          "WHERE (worklist_P.assigedby = 2) " & _
          "GROUP BY feedback.wrkID, feedback.empID, worklist_C.complited " & _
          "HAVING (feedback.empID <> " & Session("empID") & ") " & _
          "ORDER BY replyID DESC, replydate DESC"
          set rsReply = Server.CreateObject("ADODB.Recordset")

          				rsReply.Open strSql, con, 1, 3, 1
          

          Kiran Sajanikar Software Engineer Pune, India

          modified on Thursday, April 2, 2009 12:45 AM

          1 Reply Last reply
          0
          • K Kiran S S

            I have created a stored procedure in SQL Server 2005. I am trying to call that procedure from ASP (Classic asp) page. The stored procedure returns a recordset of this query.

            SELECT Count(worklist_P.wrkID) AS Total, Sum(CASE WHEN complited = 'True' then 1 else 0 end) AS [comp],
            Sum(Case when readed = 'False' then 1 else 0 end) AS new,
            Sum(Case When complited = 'False' then 1 else 0 end) AS pend
            FROM (employee_Master INNER JOIN worklist_C ON employee_Master.empID = worklist_C.assignedWhom)
            INNER JOIN worklist_P ON worklist_C.wrkID = worklist_P.wrkID WHERE (((worklist_C.assignedWhom)=@empId));

            I am calling that procedure in following code:

            set cmd = Server.CreateObject("ADODB.Command")
            cmd.ActiveConnection = con
            cmd.CommandText = "wrksCnt"
            cmd.CommandText = "{call wrksCnt(?)}"
            cmd.Parameters.Append cmd.CreateParameter("@empId", 3, 1)
            cmd.Parameters("@empId") = 2
            set rsWork = cmd.Execute()

            But it is not returning anything. I have tried executing above stored procedure in SQL Server 2005. It is running well. Giving proper output. I have also tried this code to strSql = "exec wrksCnt '" & Session("empID") & "'" set rsWork = con.Execute(strSql) This code is also not returning any value. Please guide how to call stored procedure properly in classic asp page.

            Kiran Sajanikar Software Engineer Pune, India

            K Offline
            K Offline
            Kiran S S
            wrote on last edited by
            #5

            I have tried simple stored procedures to return recordset like : Select * From It is running good, giving proper out put. But If I am making it bit complicated then recordset is returning -1 recordcount e.g. : Select Count(bId) from bTable This stored procedure is running well in SQL Server 2005, but if I am caling them in ASP pages it is returning me -1 recordcount. Please Help me

            Kiran Sajanikar

            modified on Thursday, April 2, 2009 12:46 AM

            1 Reply Last reply
            0
            • K Kiran S S

              I have created a stored procedure in SQL Server 2005. I am trying to call that procedure from ASP (Classic asp) page. The stored procedure returns a recordset of this query.

              SELECT Count(worklist_P.wrkID) AS Total, Sum(CASE WHEN complited = 'True' then 1 else 0 end) AS [comp],
              Sum(Case when readed = 'False' then 1 else 0 end) AS new,
              Sum(Case When complited = 'False' then 1 else 0 end) AS pend
              FROM (employee_Master INNER JOIN worklist_C ON employee_Master.empID = worklist_C.assignedWhom)
              INNER JOIN worklist_P ON worklist_C.wrkID = worklist_P.wrkID WHERE (((worklist_C.assignedWhom)=@empId));

              I am calling that procedure in following code:

              set cmd = Server.CreateObject("ADODB.Command")
              cmd.ActiveConnection = con
              cmd.CommandText = "wrksCnt"
              cmd.CommandText = "{call wrksCnt(?)}"
              cmd.Parameters.Append cmd.CreateParameter("@empId", 3, 1)
              cmd.Parameters("@empId") = 2
              set rsWork = cmd.Execute()

              But it is not returning anything. I have tried executing above stored procedure in SQL Server 2005. It is running well. Giving proper output. I have also tried this code to strSql = "exec wrksCnt '" & Session("empID") & "'" set rsWork = con.Execute(strSql) This code is also not returning any value. Please guide how to call stored procedure properly in classic asp page.

              Kiran Sajanikar Software Engineer Pune, India

              K Offline
              K Offline
              Kiran S S
              wrote on last edited by
              #6

              I got stuck with above issue. I am not getting any answer to it. Please help me.

              Kiran Sajanikar

              1 Reply Last reply
              0
              Reply
              • Reply as topic
              Log in to reply
              • Oldest to Newest
              • Newest to Oldest
              • Most Votes


              • Login

              • Don't have an account? Register

              • Login or register to search.
              • First post
                Last post
              0
              • Categories
              • Recent
              • Tags
              • Popular
              • World
              • Users
              • Groups