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 12th, 2005, 11:51 AM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 249
Thanks: 0
Thanked 0 Times in 0 Posts
Default Server error '80040e07' sometimes

Hello Everybody,
Can somebody please give me a clue as to why this error would be happening?

Microsoft OLE DB Provider for SQL Server error '80040e07'
Syntax error converting datetime from character string.
/sites/escapesvacations/admin/view_employ_listings.asp, line 78

line 78 is my Set objSelect = .Execute line
I have written out out my strPreview and strOrder they are correct. Now what I really cannot
figure out is that I do not get this error message if I choose to sort by Pos_ID, DatePosted or Display.

Set objCmd = Server.CreateObject("ADODB.Command")
    With objCmd
        .ActiveConnection = strConnect
        .CommandText = "sp_SelectPositions"
        .CommandType = adCmdStoredProc
        .Parameters.Append .CreateParameter("@strLocation", adVarChar, adParamInput, 50, strLocation)
        .Parameters.Append .CreateParameter("@strOrder", adInteger, adParamInput, , strOrder)
'line 78 Set objSelect = .Execute
    End With

CREATE PROCEDURE sp_SelectPositions
(
@strLocation varchar(50),
@strOrder int
)
AS
IF @strLocation = 'All'
BEGIN
SELECT Pos_ID, Title, Location, DatePosted, Display
FROM Employment
END
ELSE
BEGIN
SELECT Pos_ID, Title, Location, DatePosted, Display
FROM Employment
WHERE Location = @strLocation
ORDER BY
CASE
    WHEN @strOrder = 1 THEN Pos_ID
    WHEN @strOrder = 2 THEN Title
    WHEN @strOrder = 3 THEN SalaryRange
    WHEN @strOrder = 4 THEN Location
    WHEN @strOrder = 5 THEN DatePosted
    WHEN @strOrder = 6 THEN Display
END
END

Thanks in advanced
Mike
__________________
Peace
Mike
http://www.eclecticpixel.com
 
Old January 14th, 2005, 10:10 AM
Friend of Wrox
 
Join Date: Nov 2003
Posts: 141
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to acdsky
Default

Hi

You would typicly get this error when the Date/Time format in the Where clause or insert etc. cannot be converted by SQL server to match the data/Time format on the field in the DB. This could become tricky especially if you are using the client side date/time to pass to the server. The format might vary across machines which might explain why this could be intermittend depending on the client setting. How do you currently get the date and build the Date parameter before you pass it to the server?

Regards
Marnus
 
Old January 14th, 2005, 10:40 AM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 249
Thanks: 0
Thanked 0 Times in 0 Posts
Default

When the informtion is first inserted it is by Date() in the ASP script. I could switch that over to the GetDate() in the stored procedure when inserting into the DB. I will go ahead and switch that and see if I get the same error.
 
Old January 18th, 2005, 11:32 AM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 249
Thanks: 0
Thanked 0 Times in 0 Posts
Default

For future reference, when creating a case with different Order By then cannot be different datatypes, this article showed how to resolved this problem
http://www.aspfaq.com/show.asp?id=2501





Similar Threads
Thread Thread Starter Forum Replies Last Post
Runtime error -'-2147217913 (80040e07) kavisundar Classic ASP Databases 0 May 16th, 2007 10:04 AM
Error 500 -- Internal Server Error Vijay Kumar Servlets 2 March 26th, 2007 02:10 AM
server error when uploading to remote server ammweb ASP.NET 1.0 and 1.1 Basics 7 July 30th, 2006 01:51 AM
Microsoft JET Database Engine error '80040e07' aprnip Classic ASP Databases 1 October 22nd, 2004 07:19 AM
Error in Server when submitting this to the server zach2004 Classic ASP XML 0 March 8th, 2004 03:44 PM





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