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 December 11th, 2007, 12:24 PM
Registered User
 
Join Date: Oct 2007
Posts: 9
Thanks: 0
Thanked 0 Times in 0 Posts
Default Errors

Hi,
I need your help:

the following is the code:

Code:
 <%Dim objConn, objRS
  Set objConn = Server.CreateObject("ADODB.Connection")
  Set objRS = Server.CreateObject("ADODB.recordset")

  Dim strDatabaseType

  'strDatabaseType = "Access"
  objConn.Open "Provider=Microsoft.Jet.OLEDB.4.0;" & _
               "Data Source=D:\Databases\database1.mdb;" & _
               "Persist Security Info=False"
  strSQL ="Select * from [ORDER] WHERE CUSTOMER_NUMBER= '" & CUSTOMER_NUMBER & "'"

  ObjRS.Open strSQL, objConn%>


From that I got the following error:
 
Quote:
quote:Error Type:
Quote:
Microsoft JET Database Engine (0x80040E07)
Data type mismatch in criteria expression.
/census/vieworder.asp, line 21
------

Then I removed quote:
Code:
<%Dim objConn, objRS
  Set objConn = Server.CreateObject("ADODB.Connection")
  Set objRS = Server.CreateObject("ADODB.recordset")

  Dim strDatabaseType

  'strDatabaseType = "Access"
  objConn.Open "Provider=Microsoft.Jet.OLEDB.4.0;" & _
               "Data Source=D:\Databases\database1.mdb;" & _
               "Persist Security Info=False"
  strSQL ="Select * from [ORDER] WHERE CUSTOMER_NUMBER= #" & CUSTOMER_NUMBER & "#"

  ObjRS.Open strSQL, objConn%>
and I got :
 
Quote:
quote:Error Type:
Quote:
Microsoft JET Database Engine (0x80040E07)
Syntax error in date in query expression 'CUSTOMER_NUMBER= ##'.
/census/vieworder.asp, line 21
----------
Then I removed both '' and ## signs:

Code:
 <%Dim objConn, objRS
  Set objConn = Server.CreateObject("ADODB.Connection")
  Set objRS = Server.CreateObject("ADODB.recordset")

  Dim strDatabaseType, CUSTOMER_NUMBER

  'strDatabaseType = "Access"
  objConn.Open "Provider=Microsoft.Jet.OLEDB.4.0;" & _
               "Data Source=D:\Databases\database1.mdb;" & _
               "Persist Security Info=False"
  strSQL ="Select * from [ORDER] WHERE CUSTOMER_NUMBER= " & CUSTOMER_NUMBER & ""

  ObjRS.Open strSQL, objConn%>


and I got:

 
Quote:
quote:Error Type:
Quote:
Microsoft JET Database Engine (0x80040E14)
Syntax error (missing operator) in query expression 'CUSTOMER_NUMBER='.
/census/vieworder.asp, line 21


 
Old December 11th, 2007, 12:28 PM
Wrox Author
 
Join Date: Oct 2005
Posts: 4,104
Thanks: 1
Thanked 64 Times in 64 Posts
Send a message via AIM to dparsons
Default

....the customer_number variable is empty

================================================== =========
Read this if you want to know how to get a correct reply for your question:
http://www.catb.org/~esr/faqs/smart-questions.html
================================================== =========
.: Wrox Technical Editor :.
Wrox Books 24 x 7
================================================== =========
 
Old December 11th, 2007, 12:36 PM
Registered User
 
Join Date: Oct 2007
Posts: 9
Thanks: 0
Thanked 0 Times in 0 Posts
Default

oh..I had that variable, must has been removed while writing, sorry.






Similar Threads
Thread Thread Starter Forum Replies Last Post
Errors AGS BOOK: Professional CSS: Cascading Style Sheets for Web Design 0 September 4th, 2005 01:09 PM
Can't get errors to display with <html:errors> michaeldill JSP Basics 0 August 2nd, 2004 01:47 PM
errors alihussein3 Javascript How-To 0 August 29th, 2003 04:58 PM
errors and fixing errors Droopy XML 0 August 26th, 2003 12:47 AM
Errors Errors DB Errors Ljhopkins VS.NET 2002/2003 0 July 15th, 2003 12:42 PM





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