Wrox Programmer Forums
|
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 software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old January 22nd, 2004, 06:20 PM
aa aa is offline
Registered User
 
Join Date: Jan 2004
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default Microsoft JET Database Engine (0x80040E07)

I have a parameterised query stored in Access:
==============================================
PARAMETERS rub Double, pCode String;
SELECT Min(competition.price_rub*sqr(t_main.per_pack/competition.quantity))/[rub]
FROM competition, analogs, t_main
WHERE analogs.af_product=[pCode]
AND
analogs.af_product=t_main.pr_code
AND
analogs.direct_analog=yes
AND
analogs.competitor_id=competition.id;
================================================

It works when run in Access
Yet when ran it from ASP using
    objCom.CommandText=QueryName&" "& CDbl(par1)&",'"&par2&"'" set objRS=objCom.Execute
It returns
Microsoft JET Database Engine (0x80040E07)
Data type mismatch in criteria expression.

As a side effect, the PARAMETETRS close of the stored query gets changed to
PARAMETERS rub IEEEDouble, pCode Text ( 255 );

I swopped the order of the parameters in objCom.CommandText - no change.
VireType() for the parameters (they are taken from variables) returns 5 (double precision float) and 8 (string) respectively.

What else should I check?
 
Old January 22nd, 2004, 06:45 PM
sal sal is offline
Friend of Wrox
 
Join Date: Oct 2003
Posts: 702
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Do not pass parameters. Instead create the sql string from the asp page.



Sal
 
Old January 22nd, 2004, 08:15 PM
aa aa is offline
Registered User
 
Join Date: Jan 2004
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Good idea, thanks

 
Old January 23rd, 2004, 05:58 AM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 111
Thanks: 0
Thanked 0 Times in 0 Posts
Default

There is nothing wrong with using a parametised query - you end us with less messy string concatenation in your ASP page. However, if you want to use something other than the default type, you should use an ADO Command object, and append a Parameter object, and set an appropriate type.

Cheers
Ken

Microsoft MVP - Windows Server (IIS)
www.adOpenStatic.com
 
Old January 23rd, 2004, 07:39 AM
aa aa is offline
Registered User
 
Join Date: Jan 2004
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Thanks
Where and how do I set an appropriate type?

 
Old August 17th, 2004, 07:53 PM
Registered User
 
Join Date: Aug 2004
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via AIM to ntodorov Send a message via Yahoo to ntodorov
Default

Quote:
quote:Originally posted by aa
 Thanks
Where and how do I set an appropriate type?

    Dim cmd As New ADODB.Command
    Dim param As ADODB.Parameter
    Dim rc As Long

    ' no timeouts
    AssignProcessCodes = 0
    Conn.ConnectionTimeout = 0
    cmd.CommandTimeout = 0
    Conn.Open m_strCon
    Set cmd.ActiveConnection = Conn
    'create procedure absp_GBSReturnPeriods
    ' @haztype int = 1,
    ' @StudyCaseId int = 1,
    ' @AnalysisOptID int = 0
    cmd.CommandText = "absp_GBSReturnPeriods"
    cmd.CommandType = adCmdStoredProc

    ' prepare the 0th parameter as the SPs return code @rc int
    Set param = cmd.CreateParameter("rc", adInteger, adParamReturnValue)
    cmd.Parameters.Append param

    ' prepare the 1st parameter as @haztype int
    Set param = cmd.CreateParameter("haztype", adInteger, adParamInput)
    param.Value = m_HazType
    cmd.Parameters.Append param

    ' prepare the 2nd parameter as @StudyCaseID int
    Set param = cmd.CreateParameter("StudyCaseID", adInteger, adParamInput)
    param.Value = m_intStudyID
    cmd.Parameters.Append param

    ' prepare the 3rd parameter as @AnalysisOptID int
    Set param = cmd.CreateParameter("AnalysisOptID", adInteger, adParamInput)
    param.Value = m_AnalyseID
    cmd.Parameters.Append param

    ' execute the stored procedure
    cmd.Execute

    rc = cmd.Parameters("rc").Value

    ' show the results
    'Me.MousePointer = vbArrow
    If rc < 0 Then ...


---
tnt





Similar Threads
Thread Thread Starter Forum Replies Last Post
Microsoft JET Database Engine (0x80040E09) u813222 Classic ASP Professional 12 April 3rd, 2007 01:27 PM
Microsoft JET Database Engine (0x80040E07) gwalker_ne8 Classic ASP Databases 2 November 11th, 2006 09:32 AM
NEW: Microsoft JET Database Engine error'80040e14' rishinicolai Classic ASP Databases 4 December 13th, 2005 05:58 AM
Microsoft JET Database Engine (0x80004005) kenh BOOK: Beginning ASP 3.0 4 April 6th, 2005 08:52 AM
Microsoft JET Database Engine (0x80040E14) tks_muthu Classic ASP Databases 5 January 1st, 2005 10:17 PM





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