Click here to Skip to main content
15,885,824 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
i have one stored procedure which takes an one input parameter and returns the result. i tried lots of solutions but it not worked. it is throwing an internal server error (HTTP 500 Internal Server Error)and the page is blank
(The website cannot display the page). Could you please help me to sort out this problem.

What I have tried:

VB
Dim strSQLConnection
dim strPass2
strSQLConnection = "driver={SQL Server};server=[servername];database=[DB name];uid=;pwd=;"
Set Conn = Server.CreateObject("ADODB.Connection")
Set objCommand = Server.CreateObject("ADODB.Command")
Set objParam = Server.CreateObject("ADODB.Parameter")
Set rstUsers = Server.CreateObject("ADODB.Recordset")
Conn.Open strSQLConnection

objCommand.ActiveConnection = strSQLConnection
objCommand.commandtext = "Getdetails" 
objCommand.CommandType = 4   'defines cmd type as stored proc
Set objParm = objCommand.CreateParameter("@UserId", 3,1,,strUserId)          
objCommand.Parameters.Append objParm

set rstUsers = objCommand.Execute

If Not rstUsers.EOF Then
	strPass2 = rstUsers("ntuserid")
      
End if
Posted
Updated 8-Jun-17 5:07am
v3
Comments
Richard Deeming 8-Jun-17 11:09am    
Assuming strUserId is actually an integer, that code looks OK as far as I can see. But it has been 15+ years since I last touched ADODB!
Append and CreateParameter Methods Example (VB)[^]

You're going to need to add a custom error page, and log the error details somewhere.
How To Create a Custom ASP Error Handling Page[^]
Creating Custom ASP Error Pages[^]

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900