Results 1 to 3 of 3
  1. #1
    Join Date
    Jun 2004

    Angry Unanswered: Data type mismatch in criteria expression

    Hi all,
    Here is my code :-

    Dim oADO, oRS, sSQL
    Dim sUserID, sPassword
    sStd_ID = Request.Form("txtStd_ID")
    sStd_pwd = Request.Form("txtStd_pwd")
    sSQL = "SELECT Quizes,Midterm1,Midterm2,Final,Bonus,Grade FROM [sheet1$] 
    WHERE [Std_ID]='" & q(sStd_ID) & "' AND [Std_pwd]='" & q(sStd_pwd) & "'"
    Set oADO = CreateObject("ADODB.Connection")
    oADO.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data 
    Source=D:\Path\To\This\File.xls;Extended Properties=""Excel 
    Set oRS = oADO.Execute(sSQL)
    If oRS.EOF Then
    Response.Write "Login failed."
      <th>Midterm 1</th>
      <th>Midterm 2</th>
    End If
    oRS.Close : Set oRS = Nothing
    oADO.Close : Set oADO = Nothing
    Function q(s)
    q = Replace(s, "'", "''")
    End Function
    As you can see its linked to Excel sheet and when I try to execute the code it gives me this error :-

    Technical Information (for support personnel)

    Error Type:
    Microsoft JET Database Engine (0x80040E07)
    Data type mismatch in criteria expression.
    /results.asp, line 16

    Line 16 is :-
    Set oRS = oADO.Execute(sSQL)

    what do you think the problem is ?
    Last edited by Q80-DB; 07-26-04 at 12:59.

  2. #2
    Join Date
    Jun 2004
    Hello there ...
    thanks anyway I found the problem its about the single quotes '' I should've taken them out because am using numric characters for Std_ID and Std_pwd

  3. #3
    Join Date
    Jun 2003
    Well thanks for letting us all know what the answer was anyways...
    J. Paul Schmidt, Freelance Web and Database Developer
    Access Database Sample, Web Database Sample, ASP Design Tips

Posting Permissions

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