Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

help with IIS error 500

Status
Not open for further replies.

coladmin

Instructor
Feb 5, 2003
309
US
Hello. I am new to ASP and I am trying to write a page that runs a stored procedure on a SQL Server. I have set up a system DSN on the web server that connects to the database that I want to query but I am having trouble debugging my ASP page. I keep getting ISS error 500 and I can’t figure out what is wrong with my script. I have posted my page below. Any advice would be appreciated

thanks

Coladmin

<%@ Language=VBScript %>
<% Option Explicit %>



<%

'open a connection to the UltioPro_CMC Database
Dim objConn
Set objConn = Server.CreateObject(&quot;ADOBD.Connection&quot;)
objConn.ConnectionString = &quot;DSN=Ultipro_cmc&quot;
objConn.Open

'Create SQL String
Dim strSQL
strSQL = &quot;cmtsp_salary&quot;

'Create a recordset object
Dim objRS
Set ObjRS = Server.CreateObject(&quot;ADODB.Recordset&quot;)
objRS.Open strSQL, objConn

'Display a listing of Salary Employees and their home Phone Numbers

Response.Write &quot;<B>Employee Phone Numbers</B>&quot;
Response.Write &quot;</B>&quot;

Do While not objRS.EOF
Response.Write &quot;<BR>&quot; & objRS(&quot;eepnamelast&quot;) & &quot;, &quot; & objRS(&quot;eepnamefirst&quot;) & &quot;- &quot; & objRS(&quot;EepPhoneHomeNumber&quot;)

objRS.MoveNext

Loop

objRS.Close
Set objRS = Nothing
objConn.Close
set objConn = nothing
%>
 
coladmin,

Little hard to test your code without the db. My environment involves IIS4 on an NT4 server. I too use DSN's

One thing, is your connect statement. What you have I think should work, but see my example below. Works for me:

'
'---- CursorTypeEnum Values ----
Const adOpenForwardOnly = 0
Const adOpenKeyset = 1
Const adOpenDynamic = 2
Const adOpenStatic = 3
'---- LockTypeEnum Values ----
Const adLockReadOnly = 1
Const adLockPessimistic = 2
Const adLockOptimistic = 3
Const adLockBatchOptimistic = 4
'---- CursorLocationEnum Values ----
Const adUseServer = 2
Const adUseClient = 3
'---- LineSeparatorEnum Values ----
Const adLF = 10
Const adCR = 13
Const adCRLF = -1
'---- CommandTypeEnum Const Evaluates CommandText as a stored procedure name ----
Const adCmdStoredProc = 4


'*--- Create an ADO connection object
on error resume next
'
Set oConn = CreateObject &quot;ADODB.Connection&quot;)
'
oConn.Open &quot;DSN=plusdir&quot;
'

Dim tqryName

'*--- Assigns temp vars with info
tqryName = &quot;qryCallout&quot;

' Create a server recordset object
Set oRS = CreateObject(&quot;ADODB.Recordset&quot;)

'
'*--- Opens the recordset
oRS.Open tqryName,oConn,adOpenStatic,adLockOptimistic,adCmdStoredProc



Note that the constants could be included using the adovbs.inc file or hard coding the constants like I did here.

Also, you are calling a stored query and you recordset open is not referencing the appropriate options.

Look at:
Default for CommandTypeEnum Constants adCmdUnspecified which does not specify how to evaluate and not sure what the results would be.

My first bet is the incomplete RS.open statement. Also, try the oConn.Open &quot;DSN=plusdir&quot; approach with your code.

Little things can add up.

Hope this helps.
DougCranston
 
I tried your suggestions but I am still having the same issues. Any other ideas?
 
First thing to do, in your browser click Tools, Internet Options, Advanced Tab, scroll down and deselect 'Show Friendly HTTP Error Messages' and click OK.
Run the page again and see what the actual error is.

 
thanks I tried setting that option in IE and I still get just the standard IIS 500 error page
 
HTTP 500 - Internal server error
Internet Explorer

page cannot be displayed
 
now I am getting this error message but I cant finf the error in the script

Server object error 'ASP 0177 : 800401f3'

Server.CreateObject Failed

/cmtsalary.asp, line 8

800401f3
 
If you code is exactly as it is posted as above the createobject is mistyped

Code:
Set objConn = Server.CreateObject(&quot;ADOBD.Connection&quot;)

the adobd should be be adodb

Code:
Set objConn = Server.CreateObject(&quot;ADODB.Connection&quot;)

give that that a try
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top