Data Type mismatch

Results 1 to 4 of 4

Thread: Data Type mismatch

  1. #1
    Suri Babu Guest

    Default Data Type mismatch

    I am trying to send a value of a column(index value)selected from table(Access database)into a drop-down, to another asp program where the table is searched based on this value and the record is retrieved. When control passes to this called program, an error message appears that says <BR>"Microsoft OLE DB Provider for ODBC Drivers error &#039 80040e07&#039 "<BR>"[Microsoft][ODBC Microsoft Access Driver] Data type mismatch in criteria expression." Please advise.<BR><BR>

  2. #2
    Join Date
    Dec 1969

    Default RE: Data Type mismatch

    Show us your SQL statement building line of code. Remember that if you are searching on a date/time or text-based column in your WHERE clause, you need to surround the value you are searching for with single quotes. For example:<BR><BR>SELECT * FROM Table1 WHERE FirstName LIKE &#039Scott%&#039<BR><BR>If it is a numeric field, then DO NOT surround the value with quotes:<BR><BR>SELECT * FROM Table2 WHERE ProductID = 6<BR><BR>Happy Programming!

  3. #3
    Suri Babu Guest

    Default RE: Data Type mismatch

    hi scott,<BR>here is the SQL statement:<BR>&#060;%<BR>set conn = Server.CreateObject("ADODB.Connection")<BR>set recset = Server.CreateObject("ADODB.RecordSet")<BR>conn.Ope n "Username1"<BR>userid=Request.Form("UserID")<BR>sq l = "Select * From Contacts Where UserID=&#039"& userid &"&#039"<BR>recset.Open sql, conn<BR>%&#062;<BR><BR>-thanks

  4. #4
    Suri Babu Guest

    Default Thanks Scott. problem resolved

    Since i was moving a numeric value into a variable and using the variable in the search criteria, the variable name should have been enclosed in double quotes with leading and trailing &#039&&#039 symbol.

Posting Permissions

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