Results 1 to 6 of 6

Thread: UPDATE statment

  1. #1
    chenko
    Guest

    UPDATE statment

    Im using the update statment to change some values in my DB

    VB Code:
    1. SQLupdate = "UPDATE FILE_ID (ID1, ID2, ID3) VALUES (42, 34, 34)"
    2.  
    3. CN.Execute SQLupdate

    My question is how do I select which record to update? I already have a recordset open at the record I want with this...

    VB Code:
    1. Set rsFiles = Server.CreateObject("ADODB.Recordset")
    2. rsFiles.Open "SELECT * FROM FILE_ID WHERE ID1=23" , CN, 3, 3

  2. #2
    kayoca
    Guest
    This is how you can use the UPDATE statement.
    Code:
    UPDATE MyTable SET MyInt=(1), MyStr=('mystr') WHERE MyID=1;

  3. #3
    chenko
    Guest
    Would mine be ok if I just added "WHERE ID=23" on the end

  4. #4
    chenko
    Guest
    Code:
    "UPDATE FILE_ID (" & _
    		"ID1, ID2, ID3" & _
    		") VALUES (" & _
    		"32, 43, 54" & _ 
    		") WHERE ID1=23"
    Whats wrong with this, I get a error....

    Microsoft JET Database Engine error '80040e14'

    Syntax error in UPDATE statement.

    /simon/asp/sub.asp, line 89

  5. #5
    Fanatic Member vb_dba's Avatar
    Join Date
    Jun 2001
    Location
    Somewhere aloft between the real world and insanity
    Posts
    1,016
    That syntax is for an Insert statement, try changing to this:
    Code:
    "UPDATE FILE_ID Set ID1 = 32, ID2 = 43, ID3 = 54 " & _
    "WHERE ID1=23"
    Regards,

    Chris

  6. #6
    chenko
    Guest
    ah cheers


    I used this anyway

    SQL = "UPDATE FILE_ID Set ID1 = 32 WHERE ID1=23"
    CN.execute SQL
    SQL = "UPDATE FILE_ID Set ID1 = 32 WHERE ID2=32"
    CN.execute SQL

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