DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

+ Reply to Thread
Results 1 to 6 of 6
  1. #1
    Join Date
    Mar 2005
    Posts
    11

    Question Data type mismatch using date() function

    I know where the problem is but i just cannot get past it, please help me and tell me why I get the error message:

    Microsoft JET Database Engine (0x80040E07)
    Data type mismatch in criteria expression. (line 71)

    <%
    dim vendmsg
    dim messagedate
    dim sql
    dim idnumber
    rs.source = "SELECT * FROM Messages WHERE VendNum = '" & VendNumb & "';"
    rs.open()
    do while not rs.eof
    if rs.recordcount > 0 then
    idnumber = rs("IDNum")
    vendmsg = rs("Message")
    messagedate = rs("DateCreated")
    todaysdate = date()
    rs.close
    sql = "UPDATE Messages SET DateDisplayed = '" & todaysdate & "' WHERE VendNum = '" & VendNumb & "' AND IDNum = '" & idnumber & "';"
    rs.open(sql)
    else
    vendmsg = "You have no new messages."
    messagedate = date
    end if
    response.Write("<font color=#cc0000 size=4 face=Georgia>" & messagedate & "<BR>" & vendmsg & "<BR><br>")
    rs.movenext()
    loop
    %>

  2. #2
    Join Date
    Dec 2003
    Posts
    2,750
    Are VendNum and ISNum Text or Number database types? If they are Number then remove the single quotes. Is DateDisplayed a Text or Date/Time database type?

    Which line of code is 71?
    Paul
    ~~~~
    Microsoft MVP (Visual Basic)

  3. #3
    Join Date
    Mar 2005
    Posts
    11

    Exclamation Fixed and now another problem

    Paul,
    It was the IDNum with the literal quotes around it. Now I am getting an error with the "rs.movenext()" function. It says that this action cannot be performed when the database is open.....so what is my problem now....where am I missing something or have something out of place?

  4. #4
    Join Date
    Dec 2003
    Posts
    2,750
    Where is your Connection object? I don't see a connection for your Recordset object.
    Paul
    ~~~~
    Microsoft MVP (Visual Basic)

  5. #5
    Join Date
    Mar 2005
    Posts
    11
    I am using a seperate file for the connection....

    // FileName="Connection_ado_conn_string.htm"
    // Type="ADO"
    // DesigntimeType="ADO"
    // HTTP="false"
    // Catalog=""
    // Schema=""
    'MM_SOASCon_STRING = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=c:\\inetpub\wwwroot\SupplierPortal\SupplierLogin.mdb"
    MM_SOASCon_STRING = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & server.mappath("./SupplierLogin.mdb")& ";"
    set rs = Server.CreateObject("ADODB.Recordset")
    rs.ActiveConnection = MM_SOASCon_STRING
    rs.CursorType = 0
    rs.CursorLocation = 3
    rs.LockType = 3

  6. #6
    Join Date
    Dec 2003
    Posts
    2,750
    Since you appear to be re-using your Recordset object I would recommend creating a separate Connection object and placing that in your include file (I'm assuming that you posted the code from an include file).

    Whenever you create and open a new Recordset specify the Connection object as a parameter in the Open statement, or set the Recordset's ActiveConnection property to the Connection object.
    Paul
    ~~~~
    Microsoft MVP (Visual Basic)

Similar Threads

  1. Is inheritance overrated?
    By Phil Weber in forum .NET
    Replies: 67
    Last Post: 12-15-2002, 01:37 AM
  2. Replies: 0
    Last Post: 10-11-2002, 10:52 AM
  3. Getting a list of files into an array
    By Scott in forum VB Classic
    Replies: 12
    Last Post: 12-21-2001, 04:21 PM
  4. Getting a GUI to function
    By Eric in forum Java
    Replies: 1
    Last Post: 11-27-2001, 06:53 AM
  5. Data Type Mismatch in DAO
    By Shlomo in forum VB Classic
    Replies: 2
    Last Post: 09-07-2001, 11:36 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


Top DevX Stories

Easy Web Services with SQL Server 2005 HTTP Endpoints
JavaOne 2005: Java Platform Roadmap Focuses on Ease of Development, Sun Focuses on the "Free" in F.O.S.S.
Wed Yourself to UML with the Power of Associations
Microsoft to Add AJAX Capabilities to ASP.NET
IBM's Cloudscape Versus MySQL


Sponsored Links