Results 1 to 3 of 3

Thread: Update Statement

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Mar 2000
    Location
    Manchester
    Posts
    446

    Update Statement

    Hi All,

    I have a form that i populate using the id on the selected row:

    Once i have edited the data i want to use an update statement or what ever is suitable to update the currently selected row. The form is populated using the filed name to put the currently held value in, once edited, i would like to update but i'm having problem getting the right update statement from the form... does anyone have an example or a solution to this problem.??

    Many thanks Gary
    "Life isn't about finding yourself. Life is about creating yourself."
    --George Bernard Shaw

  2. #2
    Frenzied Member monte96's Avatar
    Join Date
    Sep 2000
    Location
    Somewhere in AZ
    Posts
    1,379
    You'll need to build the update query string in code from your Request.Form() variables on the page the form is submitted to.

    Something to the tune of:
    Code:
    strSQL = "Update tablename (field1, field2, field3,...) values(" & Request.Form("Field1") & ", " & Request.Form("Field2") & ", " & Request.Form("Field3") & ")"
    Now, if any of these fields are strings, you will need to put single quotes 'around them':
    Code:
    strSQL = "Update tablename (field1, field2, field3,...) values('" & Request.Form("Field1") & "', '" & Request.Form("Field2") & "',' " & Request.Form("Field3") & "')"
    Then just feed it to your Connection object's Execute method:
    Code:
    cnConn.Execute strSQL
    oOOo--oOOo
    __/\/\onte96
    oOOo--oOOo
    Senior Programmer/Analyst
    MCP
    [email protected]
    [email protected]


    Your results may vary.. some restrictions may apply.. pricing and participation may vary.. not available in all states.. professional driver closed course..quantities limited..

  3. #3

    Thread Starter
    Hyperactive Member
    Join Date
    Mar 2000
    Location
    Manchester
    Posts
    446
    Cheers, i'll give it a whirl.
    "Life isn't about finding yourself. Life is about creating yourself."
    --George Bernard Shaw

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