Calling stored procedure from ASP page.
-
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
-
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
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[^]
-
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[^]
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
-
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
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
-
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
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
-
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