I have a Stored Proc that looks for a username and password to be passed in. I supply those values from a form. Below is my code. I cannot get it to work. I was asked to model the code after the a website, but the site doesn't help me really.
I want to gracefully work in the code from the webpage below into my asp page (code below). However, no matter what I do, the page will not load. Error: This error (HTTP 500 Internal Server Error) means that the website you are visiting had a server problem which prevented the webpage from displaying.
The SP and page work fine when I do this: query = "EXEC sp_GetUser '" & userName & "','" & password & "'", but I have been asked to use the webpage... Argh!
Here is the web address: Link
Here is what I have:
I want to gracefully work in the code from the webpage below into my asp page (code below). However, no matter what I do, the page will not load. Error: This error (HTTP 500 Internal Server Error) means that the website you are visiting had a server problem which prevented the webpage from displaying.
The SP and page work fine when I do this: query = "EXEC sp_GetUser '" & userName & "','" & password & "'", but I have been asked to use the webpage... Argh!
Here is the web address: Link
Here is what I have:
Code:
<%@ LANGUAGE="VBSCRIPT" %>
<HTML>
<HEAD>
<TITLE>Document Title</TITLE>
</HEAD>
<BODY>
<%
dim userName, password
dim conn
userName = Request.Form("userName")
password = Request.Form("password")
set conn = server.createObject("ADODB.Connection")
conn.Open "Provider=SQLOLEDB;server=ip_addr; Initial Catalog=db; User Id=user; Password=pass"
Set cmd = Server.CreateObject("ADODB.Command")
With cmd
.ActiveConnection = conn
.CommandType = adCmdStoredProc
.CommandText = "sp_GetUser"
.Parameters.Append .CreateParameter("@user",adVarChar, adParamInput, 50)
.Parameters("@user") = "userName"
.Parameters.Append .CreateParameter("@pass",adVarChar, adParamInput, 20)
.Parameters("@pass") = "password"
set rs = .Execute
End With
if not rs.eof then
response.write "Logged In As: " & rs.fields(0).value
else
response.write "Bad Credentials"
end if
response.write query & "<P>"
%>
</BODY>
</HTML>