Results 1 to 3 of 3

Thread: SQL Update command

Threaded View

  1. #1

    Thread Starter
    Member
    Join Date
    Dec 2004
    Posts
    44

    Resolved SQL Update command

    I am trying to do an update of a database record but i keep getting an error message saying " datatype mismatch in criteria expression". I have checked my datatypes in database against my variable datatypes and things match up, but still get the error.

    Table Columns
    ProductID - Autonumber - long id - long
    PRODUCTNAME - text prodname - string
    DESCRIPTION - text proddesc - string
    Price - currency price - currency
    quantity - integer qty - integer
    category - text cat - text
    image - text prodimage - string

    The left is the database columns and datatypes, to the right are the variable names and datatypes. I can't see how there could be a mismatch???
    Below is the code using for the SQL command:
    Set ors = New ADODB.Recordset
    ors.LockType = adLockOptimistic

    SQL = "UPDATE tblProducts "
    SQL = SQL & "SET PRODUCTNAME = '" & prodname & "', DESCRIPTION = '" & proddesc & "', CATEGORY='" & cat & "', PRICE= '" & price & "', QUANTITY='" & qty & "' "
    SQL = SQL & "WHERE PRODUCTID = '" & id & "'"
    Text1.Text = SQL

    Set ors = oConn.Execute(SQL).

    this should work(i think), but doesn't. I can't seem to find any error in the SQL statement. Can someone help me out again here. Thanks again in advance.

    oobern
    Last edited by oobern; Feb 8th, 2005 at 03:53 PM. Reason: RESOLVED

Posting Permissions

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



Click Here to Expand Forum to Full Width