Why are you using nvarchar in your stored proc?
Shouldn't you be using varchar?
Main Topics
Browse All TopicsThe 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
Dim objconn, objRS, adocmd
Set objconn = Server.CreateObject("ADODB
objconn.Open (ConnectionString)
Set adocmd = Server.CreateObject("ADODB
adocmd.CommandText = "GetRespondentDemographics
adocmd.CommandType = adCmdStoredProc
objRS = Server.CreateObject("ADODB
adocmd.activeConnection = objconn
adocmd.Parameters.Append adocmd.CreateParameter("@E
adocmd.Parameters.Append adocmd.CreateParameter("@R
adocmd.Parameters("@Respon
adocmd.Parameters("@Respon
adocmd.Parameters("@Email"
adocmd.Parameters("@Respon
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
The line this is referring to is: adocmd.Parameters("@Respon
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
This Question has been solved and asker verified All Experts Exchange premium technology solutions are available to subscription members.
Experts Exchange has been collecting answers to technology questions since 1996…3 million and counting! If you have a question, chances are we already have your answer.
If you can't find the exact answer you're looking for, ask our exclusive community of 50,000 experts. You’ll get a personalized answer from a trusted professional.
Thousands of free tech tips, tricks, how-to’s and tutorials are available in our peer reviewed articles section. See for yourself how smart our experts are, no login required.
Access the answers to your technology questions today.
30-day free trial. Register in 60 seconds.
Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Try it out and discover for yourself.
30-day free trial. Register in 60 seconds.
Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.
hclgroup,
That part of the code works perfectly. As I stated above, the email part of the code works fine. The problem exists only when I leave the "respondentid" field blank. If I were to comment out this line, adocmd.Parameters("@Respon
The program also executes when I have data in the 'respondentid' field. The problem only persists when the 'respondentid' is left empty.
Thanks for your help.
Doh! I thought I had tried that. Alright well I created this if-then statement:
if (Request.Form("respondenti
adocmd.Parameters.Append adocmd.CreateParameter("@E
adocmd.Parameters("@Email"
set objRS = adocmd.Execute
else
adocmd.Parameters.Append adocmd.CreateParameter("@E
adocmd.Parameters.Append adocmd.CreateParameter("@R
adocmd.Parameters("@Respon
adocmd.Parameters("@Respon
adocmd.Parameters("@Email"
adocmd.Parameters("@Respon
set objRS = adocmd.Execute
end if
It appears to be working fine at a certain extent. The problem I am having now is that if I were to enter both of the fields (Email and respondentid), it will not check to see if the email is in the correct email format (which it will do if ONLY the email field was filled out). Also, if both fields were filled out and the respondentid was the correct one but the email was incorrect, it will still show the results because the respondentid was filled out correctly thus returning the results.
I would like it so if both fields are filled out and if one of the fields are incorrect (as in that it won't match the database table), the output will show 'no results found'.
Am I making sense or not? Let me know if you got some suggestions. Thanks
Alright I figured out what I was doing wrong BUT I have another question if you can assist me on it.
As you know I have two fields (Email and RespondentID). The user has the option of choosing either or but never both of them.
Is there a javascript code which will disable one field if the user decides to type in another field.
Ex: The user types in an E-mail, the RespondentID field box will be disabled in that the user will be Unable to type in anything in there; and vice versa.
I have found codes which disable and enable but not what I am looking for as stated above.
Any Help wil be appreciated. Thanks
Business Accounts
Answer for Membership
by: pimpp1184Posted on 2006-11-26 at 18:15:50ID: 18016522
Any suggestions at all from anyone on this? Thanks