473,320 Members | 2,124 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

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 3115
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

7
by: Dave | last post by:
I have 2 tables, one with names, and another with addresses, joined by their CIVICID number (unique to the ADDRESSINFO table) in Oracle. I need to update a field in the NAMEINFO table for a...
8
by: Lauren Quantrell | last post by:
In VBA, I constructed the following to update all records in tblmyTable with each records in tblmyTableTEMP having the same UniqueID: UPDATE tblMyTable RIGHT JOIN tblMyTableTEMP ON...
27
by: VK | last post by:
<http://www.jibbering.com/faq/#FAQ3_2> The parts where update, replacement or add-on is needed are in <update> tag. 3.2 What online resources are available? Javascript FAQ sites, please...
16
by: Philip Boonzaaier | last post by:
I want to be able to generate SQL statements that will go through a list of data, effectively row by row, enquire on the database if this exists in the selected table- If it exists, then the colums...
3
by: Shapper | last post by:
Hello, I have created 3 functions to insert, update and delete an Access database record. The Insert and the Delete code are working fine. The update is not. I checked and my database has all...
9
by: jaYPee | last post by:
I have search a lot of thread in google newsgroup and read a lot of articles but still i don't know how to update the dataset that has 3 tables. my 3 tables looks like the 3 tables from...
5
by: PAUL | last post by:
Hello, I have 2 tables with a relationship set up in the dataset with vb ..net. I add a new record to the parent table then edit an existing child record to have the new parent ID. However when I...
8
by: Zorpiedoman | last post by:
I keep getting a concurrency exception the second time I make a change and attempt to update a dataadapter. It appears this is by design, so there must be something I can do to avoid it. ...
5
by: Stephen Plotnick | last post by:
I'm very new to VB.NET 2003 Here is what I have accomplished: MainSelectForm - Selects an item In a public class I pass a DataViewRow to ItemInformation1 Form ItemInformation2 Form
3
by: Michel Esber | last post by:
Hi all, DB2 V8 LUW FP 15 There is a table T (ID varchar (24), ABC timestamp). ID is PK. Our application needs to frequently update T with a new value for ABC. update T set ABC=? where ID...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.