Data typr mismatch error

Results 1 to 3 of 3

Thread: Data typr mismatch error

  1. #1
    Join Date
    Dec 1969

    Default Data typr mismatch error

    I am getting the following error when trying to execute a script:<BR><BR>Microsoft OLE DB Provider for ODBC Drivers error &#039 80040e07&#039 <BR>[Microsoft][ODBC Microsoft Access Driver] Data type mismatch in criteria expression. <BR>/bushead/cgi-bin/includes/detail.asp, line 16 <BR><BR>The page is called detail.asp and the querystring is:<BR>detail.asp?ProductCode=4<BR><BR>Here is the code up to line 16:<BR><BR>&#060;%<BR> StrConnect = "Driver={Microsoft Access Driver (*.mdb)}; DBQ=E:blahblahblahproducts.mdb"<BR> Set conn = Server.CreateObject("ADODB.Connection")<BR> conn.Open StrConnect<BR>%&#062;<BR>&#060;form method="Post" action="cgi-bin/includes/addprod.asp"&#062;<BR>&#060;center&#062;<BR>&#060; %<BR>ProductCode = Request.QueryString("ProductCode")<BR>%&#062;<BR>< BR><BR>&#060;%<BR> sql = "SELECT * FROM TblPrducts WHERE (TblPrducts.ProductCode= &#039"&ProductCode&"&#039)"<BR> Set rs = Server.CreateObject("ADODB.Recordset")<BR> rs.Open sql, conn, 3, 3<BR>%&#062;<BR><BR><BR>Thanks!<BR>ScottB

  2. #2
    Adam Werner Guest

    Default RE: Data typr mismatch error

    I&#039m pretty sure I&#039ve come across this before. My initial guess here is that your field &#039ProductCode&#039 is a number data type. Try removing your (&#039) around where you pass your ProductCode.<BR><BR>Your line of code should look something like this:<BR><BR>sql = "SELECT * FROM TblPrducts WHERE (TblPrducts.ProductCode=" & ProductCode & ")"<BR><BR>Give that a try.

  3. #3
    Join Date
    Dec 1969

    Default RE: Data typr mismatch error

    Adam - Thanks for the help. That did it.

Posting Permissions

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