The following is the code that I am using:
Stored Procedure (Partial code):
CREATE PROCEDURE GetRespondentDemographics
@Email nvarchar(75) = null,
@Respondentid dec(19,0) = null
.......
My ASP Code:
<%
Dim ConnectionString
Dim ofso
Dim otmp
ConnectionString="Provider
=SQLOLEDB;
Data Source=TEST_W2K_SQL2K;Data
base=harri
spoll;UID=
paramtestu
ser;PWD=pa
ramtestuse
r;Network Library=dbmssocn;"
Dim objconn, objRS, adocmd
Set objconn = Server.CreateObject("ADODB
.Connectio
n")
objconn.Open (ConnectionString)
Set adocmd = Server.CreateObject("ADODB
.Command")
adocmd.CommandText = "GetRespondentDemographics
"
adocmd.CommandType = adCmdStoredProc
objRS = Server.CreateObject("ADODB
.Recordset
")
adocmd.activeConnection = objconn
adocmd.Parameters.Append adocmd.CreateParameter("@E
mail",adVa
rChar, adParamInput, 75)
adocmd.Parameters.Append adocmd.CreateParameter("@R
espondenti
d",adDecim
al, adParamInput, 19)
adocmd.Parameters("@Respon
dentid").P
recision = 19
adocmd.Parameters("@Respon
dentid").N
umericScal
e = 0
adocmd.Parameters("@Email"
) = Request.Form("email")
adocmd.Parameters("@Respon
dentid") = Request.Form("respondentid
")
set objRS = adocmd.Execute
Ok. I have 2 fields (RespondentID and Email). The user must select at least one of the fields even though both fields can be filled out. Now my problem is that when I only enter the respondentID, I am able to get the results back without a problem BUT when I only enter the email field, I get the following error:
"Error Type:
ADODB.Command (0x800A0D5D)
Application uses a value of the wrong type for the current operation.
/param/HPoll_email_respond
ent_result
s.asp, line 28"
The line this is referring to is: adocmd.Parameters("@Respon
dentid") = Request.Form("respondentid
")
When I comment out this field and I go back and enter an email within the email field, the program executes and displays the results without a problem. I do not understand why I am getting this error. The line that it is referring to as incorrect appears correct from my point of view. Any suggestions as to why I might getting this error? Thanks