All,
It's been a long time since I have worked with asp and I can't figure out what I am doing wrong. I am trying to execute a stored procedure and store the results in a session variable. On my .asp page I have a include file<!--#include file = "../common/Connect.inc" -->
The Connect.inc file contains the following:
<% strConnect = "Provider=SQLOLEDB.1;test_user;pwd=test_pass;database=test;server=testserver;driver={sql server};dsn=''"%>
The .asp page looks something like this:
Dim objConn
Dim objCmd
Dim conn
Dim rsRequestor
Set objConn = Server.CreateObject("ADODB.Connection")
set objCmd = Server.CreateObject("ADODB.Command")
conn.Open Application("strConnect")
With objCmd
.ActiveConnection = conn
.CommandText = "sp_Requestor"
.CommandType = adCmdStoredProc
'Add Input Parameters
.Parameters.Append .CreateParameter("@loginname", adVarChar, adParamInput, 50, "abc@abc.com")
'Execute the function
.Execute
End With
if not rsRequestor.EOF then
session("RequestID") = rsRequestor("Requestid")
End if
rsRequestor.close
Set rsRequestor = nothing
Set Connect = nothing
Set objParam = nothing
I have several known issues:
1. This does not work
2. When I execute objCmd how do I populate the recordset so I can use the values in my if statement?
Thanks in advance.
It's been a long time since I have worked with asp and I can't figure out what I am doing wrong. I am trying to execute a stored procedure and store the results in a session variable. On my .asp page I have a include file<!--#include file = "../common/Connect.inc" -->
The Connect.inc file contains the following:
<% strConnect = "Provider=SQLOLEDB.1;test_user;pwd=test_pass;database=test;server=testserver;driver={sql server};dsn=''"%>
The .asp page looks something like this:
Dim objConn
Dim objCmd
Dim conn
Dim rsRequestor
Set objConn = Server.CreateObject("ADODB.Connection")
set objCmd = Server.CreateObject("ADODB.Command")
conn.Open Application("strConnect")
With objCmd
.ActiveConnection = conn
.CommandText = "sp_Requestor"
.CommandType = adCmdStoredProc
'Add Input Parameters
.Parameters.Append .CreateParameter("@loginname", adVarChar, adParamInput, 50, "abc@abc.com")
'Execute the function
.Execute
End With
if not rsRequestor.EOF then
session("RequestID") = rsRequestor("Requestid")
End if
rsRequestor.close
Set rsRequestor = nothing
Set Connect = nothing
Set objParam = nothing
I have several known issues:
1. This does not work
2. When I execute objCmd how do I populate the recordset so I can use the values in my if statement?
Thanks in advance.