469,360 Members | 1,799 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,360 developers. It's quick & easy.

UPDATE

I'm trying to update my database fields
Employee, Status and Location with values from a form.
Is this going to work?

Dim strEmployee, strStatus, strLocation

strEmployee= request.form("Employee")
strStatus = Request.Form("Status")
strLocation = Request.Form("Location")

SQLstmt = "UPDATE Table SET "

SQLstmt = SQLstmt & "RS("Employee")= strEmployee"
SQLstmt = SQLstmt & "RS("Status")= strStatus"
SQLstmt = SQLstmt & "RS("Location")= strLocation"
Jul 19 '05 #1
3 3068
No, try this:

strEmployee= request.form("Employee")
strStatus = Request.Form("Status")
strLocation = Request.Form("Location")

SQLstmt = "UPDATE Table SET [Employee]='" & strEmployee & "',[Status]='" &
strStatus & "',[Location]='" & strLocation & "'"

That statement will update EVERY record though if you don't have a WHERE
clause, i.e. WHERE [EmployeedID]=6.

Ray at work
"alexz" <al*****@hotmail.com> wrote in message
news:43**************************@posting.google.c om...
I'm trying to update my database fields
Employee, Status and Location with values from a form.
Is this going to work?

Dim strEmployee, strStatus, strLocation

strEmployee= request.form("Employee")
strStatus = Request.Form("Status")
strLocation = Request.Form("Location")

SQLstmt = "UPDATE Table SET "

SQLstmt = SQLstmt & "RS("Employee")= strEmployee"
SQLstmt = SQLstmt & "RS("Status")= strStatus"
SQLstmt = SQLstmt & "RS("Location")= strLocation"

Jul 19 '05 #2
On 17 Jul 2003 09:55:27 -0700, al*****@hotmail.com (alexz) wrote:
I'm trying to update my database fields
Employee, Status and Location with values from a form.
Is this going to work?

Dim strEmployee, strStatus, strLocation

strEmployee= request.form("Employee")
strStatus = Request.Form("Status")
strLocation = Request.Form("Location")

SQLstmt = "UPDATE Table SET "

SQLstmt = SQLstmt & "RS("Employee")= strEmployee"
SQLstmt = SQLstmt & "RS("Status")= strStatus"
SQLstmt = SQLstmt & "RS("Location")= strLocation"


It appears that you are not telling the database table which records to update ---So it may update all your existing
records
You may want to add something like

SQLstmt = SQLstmt & " Where some_field_in_the_table = some_field_to_identify_which_record_get_this_updat e"

( I am not sure what the RS refers to, since I do not see any Recordset )


Jul 19 '05 #3
TurkBear <no***@nowhere.com> wrote in message news:<sk********************************@4ax.com>. ..
On 17 Jul 2003 09:55:27 -0700, al*****@hotmail.com (alexz) wrote:
I'm trying to update my database fields
Employee, Status and Location with values from a form.
Is this going to work?

Dim strEmployee, strStatus, strLocation

strEmployee= request.form("Employee")
strStatus = Request.Form("Status")
strLocation = Request.Form("Location")

SQLstmt = "UPDATE Table SET "

SQLstmt = SQLstmt & "RS("Employee")= strEmployee"
SQLstmt = SQLstmt & "RS("Status")= strStatus"
SQLstmt = SQLstmt & "RS("Location")= strLocation"


It appears that you are not telling the database table which records to update ---So it may update all your existing
records
You may want to add something like

SQLstmt = SQLstmt & " Where some_field_in_the_table = some_field_to_identify_which_record_get_this_updat e"

( I am not sure what the RS refers to, since I do not see any Recordset )


Thanks, Got it working.
Jul 19 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

7 posts views Thread by Dave | last post: by
8 posts views Thread by Lauren Quantrell | last post: by
27 posts views Thread by VK | last post: by
16 posts views Thread by Philip Boonzaaier | last post: by
5 posts views Thread by PAUL | last post: by
8 posts views Thread by Zorpiedoman | last post: by
5 posts views Thread by Stephen Plotnick | last post: by
3 posts views Thread by Michel Esber | last post: by
1 post views Thread by CARIGAR | last post: by
reply views Thread by zhoujie | last post: by
reply views Thread by suresh191 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.