I have the following code in my ASP page. The problem is that when I execute
the command I get an error saying
"Item can not be found in the collection corresponding to the requested name
or ordinal"
What can be the problem?
Thanks in advance
'***************
'Open connectoin
'***************
sub OpenDB
'Instantiate obj vars
set conn = Server.CreateObject("ADODB.Connection")
set comm = Server.CreateObject("ADODB.Command")
set rs = Server.CreateObject("ADODB.Recordset")
'Open DB
'conn.Open "advertisementDB"
conn.Open "Provider=SQLOLEDB;Data Source=ROBERTODELL;Initial
Catalog=AdvertisingDB;User ID=sa"
'Call to help Function on gen_functions.asp
end sub
'***********
'Setup SProc
'***********
sub SetupProcedure(strProcName)
'Setup procedure
comm.ActiveConnection = conn
comm.CommandType = adCmdStoredProc
comm.CommandText = strProcName
comm.Parameters.Refresh
end sub
'********************
'Fill Proc Parameters
'********************
sub FillParameters
'Fill parameters and Execute command
command.Parameters.append
command.Parameters.createparameter("return",adInteger,adParamReturnValue,4)
command.Parameters.append
command.Parameters.createparameter("@UserID",adVarchar,adParamInput,20) =
request.form("edtName")
command.Parameters.append
command.Parameters.createparameter("@Password",adVarchar,adParamInput,30,
request.form("edtPassword"))
command.Parameters.append
command.Parameters.createparameter("@URL",adVarchar,adParamOuput,255, "")
end sub
'*****
'Login
'*****
sub Login
on error resume next
'Fill parameters based in form
FillParameters
'Execute command... be ready to display exceptions generated by DB
comm.Execute
IsValid = comm.Parameters("return")
'If an error happened in DB
if err.Number <> 0 then
DisplayForm
response.Write "<center><br><font color='red'>" & err.Description &
"</font></center>"
'No errors, save session var and redirect
else
if IsValid = 0 then
SaveAndRedirect
else
if IsValid = 1 then
DisplayForm
response.Write "<center><br><font color='red'> Password Invalid. Try
Again. </font></center>"
else
if IsValid = 2 then
response.Write "<center><br><font color='red'> Password has expired.
Contact your administrator. </font></center>"
end if
end if
end if
end if
end sub
--
Joe
"Julio Gonzalez" <jcqu...@hotmail.com> wrote in message
news:edXhpqgY...@TK2MSFTNGP09.phx.gbl...
HTH,
Bob Barrows
PS. Make sure you have the ado constants defined, either by #including the
adovbs.inc file, or using the technique described here:
http://www.aspfaq.com/show.asp?id=2112