help ! new in asp

Results 1 to 3 of 3

Thread: help ! new in asp

  1. #1
    randy Guest

    Default help ! new in asp

    hi all ... I am having this error that I have not a single clue in solving it. May I know how to solve this error. Below is the error.<BR><BR>Microsoft OLE DB Provider for ODBC Drivers error &#039 80040e07&#039 <BR><BR>[Microsoft][ODBC Microsoft Access Driver] Data type mismatch in criteria expression. <BR><BR>/search_engine_results.asp, line 51 <BR><BR>here is the coding<BR>line 51 = Set rs_main = dataCmd.Execute<BR><BR><BR>&#060;%<BR> Dim dataConn, dataCmd, rs_main<BR> <BR> Set dataConn=Server.CreateObject("ADODB.Connection")<B R> dataConn.ConnectionString = "DRIVER={Microsoft Access Driver (*.mdb)};" & _<BR> "DBQ=C:inetpubwwwrootuser_profile.mdb"<BR> dataConn.ConnectionTimeout = 15<BR> dataConn.CommandTimeout = 30<BR> dataConn.Open<BR> <BR> Set dataCmd=Server.CreateObject("ADODB.Command")<BR> dataCmd.CommandText= "SELECT * FROM Product WHERE Category_ID = &#039"&productCategoryname&"&#039 OR " & _<BR> "ProductName = &#039"&productTitle&"&#039 OR ProductReferenceNumber = &#039"&productReferenceno&"&#039 OR " & _<BR> "ProductBrand = &#039"&productBrand&"&#039 OR ProductHotDeal = &#039"&productHotdeal&"&#039;"<BR> <BR> Set dataCmd.ActiveConnection=dataConn<BR> <BR> Set rs_main = Server.CreateObject("ADODB.Recordset")<BR> Set rs_main = dataCmd.Execute<BR>%&#062;<BR>

  2. #2
    Join Date
    Dec 1969

    Default RE: help ! new in asp

    Did you debug your code? Did you print out your SQL statement after it&#039s been created to find out just what it came out looking like? Are any of your database fields numeric? Say maybe the ProductReferenceNumber field? If so, then you have a problem right there. Numeric fields don&#039t get enclosed in &#039&#039 like strings do.<BR><BR>I&#039m curious, why not just write your SQL statement into a variable and then do set objRec = objConn.execute(SQL) Also, you are closing your connections and setting them to nothing, correct? Otherwise, as it stands here, every connection that you open stays open for 15 minutes. Do you realize the problems this can cause for the server?

  3. #3
    Join Date
    Dec 1969

    Default RE: help ! new in asp

    remove the single quotes here if this data type is numeric you do not need it enclosed in single quotes<BR><BR>OR ProductReferenceNumber = &#039"&productReferenceno&"&#039

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts