Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > ASP.NET and ASP > ASP 3 Classic ASP Active Server Pages 3.0 > Classic ASP Databases
Password Reminder
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
Classic ASP Databases Discuss using ASP 3 to work with data in databases, including ASP Database Setup issues from the old P2P forum on this specific subtopic. See also the book forum Beginning ASP.NET Databases for questions specific to that book. NOT for ASP.NET 1.0, 1.1, or 2.0.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Classic ASP Databases section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old December 28th, 2004, 12:54 AM
Friend of Wrox
Join Date: Jun 2003
Location: Oklahoma City, Oklahoma, USA.
Posts: 249
Thanks: 0
Thanked 0 Times in 0 Posts
Default advance search with stored procedure

Hello, can somebody please help me here. I cannot figure it out or find any information on how to create an advanced search. I have a form with the 3 options of searching for a PrintBuyer, ProjectNumber, or ProjectTitle. I am getting the following error when I do not select the option of PrintBuyer.

ADODB.Command error '800a0d5d'
Application uses a value of the wrong type for the current operation.
searchresults.asp, line 51

If I understand what is happening here is that the the SP is grabbing the ProjectNumber instead, how can I resolve this? If I do test the strPrintBuyer with an IF statement I get, basically the same error.

Microsoft OLE DB Provider for SQL Server error '80040e07'
Error converting data type varchar to int.
searchresults.asp, line 57

Now if I do select a PrintBuyer it will pull up all of my records, but if I add something to the ProjectNumber or ProjectTitle, it will not find any information.

Set objCmd = Server.CreateObject("ADODB.Command")
    With objCmd
        .ActiveConnection = strConnect
        .CommandText = "sp_SelectProject"
        .CommandType = adCmdStoredProc
        .Parameters.Append .CreateParameter("@strPrintBuyerID", adInteger, adParamInput, , strPrintBuyer)
        .Parameters.Append .CreateParameter("@strProjNo", adVarChar, adParamInput, 50, strProjNo)
        .Parameters.Append .CreateParameter("@strProjTitle", adVarChar, adParamInput, 50, strProjTitle)
        .Parameters.Append .CreateParameter("@strOrderBy", adVarChar, adParamInput, 50, strOrderBy)
        Set objSelect = .Execute
    End With

Set objCmd = Nothing

@strPrintBuyerID int,
@strProjNo varchar (50),
@strProjTitle varchar (50),
@strOrderBy varchar (50)
SELECT ProjID, PrintBuyerID, ProjDate, ProjNo, ProjTitle, ProjOtherInfo
FROM Projects
WHERE PrintBuyerID = @strPrintBuyerID
AND ProjNo LIKE @strProjNo%
AND ProjTitle LIKE @strProjTitle%
CASE WHEN @strOrderBy='ProjDate' THEN Proj_Date
WHEN @strOrderBy='ProjNo' THEN Proj_No
WHEN @strOrderBy='ProjTitle' THEN Proj_Title

Many Thanks
Mike Moore
Reply With Quote
  #2 (permalink)  
Old December 29th, 2004, 04:02 AM
Friend of Wrox
Join Date: Sep 2004
Location: Hyderabad, Andhra Pradesh, India.
Posts: 104
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via AIM to sureshbabu Send a message via Yahoo to sureshbabu

 please check the data types ofinput values you are sending to the database whether these are matching the data types of data base fields.

Reply With Quote

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Bugbase Search Stored Procedure johncross912 BOOK: ASP.NET 2.0 Instant Results ISBN: 978-0-471-74951-6 5 August 22nd, 2007 12:51 AM
Stored Procedure muthu555 SQL Server 2000 1 March 5th, 2007 07:13 AM
Fulltext Search Stored Procedure. maulik77 SQL Server 2000 0 December 28th, 2006 11:52 PM
Advance search recordset giving error message? yts007 Dreamweaver (all versions) 15 January 13th, 2006 01:54 AM
please help me with this stored procedure bebeko SQL Server 2000 1 June 10th, 2005 12:09 PM

All times are GMT -4. The time now is 12:59 PM.

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.