|
|
|||||||||
|
|||||||||
|
|||||||||
| |
||
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
Updating multiple fields from the same table with unique values
I would like to update multiple fields from a database with like this
Code:
UpdateSQL = "UPDATE product_info SET atomizer_media=" & "'" & atomizer_media & "'"
Set updateADODB = dbWriteConnection.Execute(UpdateSQL)
UpdateSQL = "UPDATE product_info SET is_repackable=" & "'" & is_repackable & "'"
Set updateADODB = dbWriteConnection.Execute(UpdateSQL)
Unforunately I can only get the first execution to work. I know I need to combine this statements somehow but the commas and quotations are throwing me off. Can anyone help? Thanks |
|
#2
|
|||
|
|||
|
Quote:
Here is another approach I have going. Im getting a syntax error now. Code:
UpdateSQL = "UPDATE product_info SET direct_instruct=" & "'" & new_direct_instruct & "'"
UpdateSQL = UpdateSQL & " flush_media=" & "'" & new_flush_media & "'"
Set updateADODB = dbWriteConnection.Execute(UpdateSQL)
|
|
#3
|
||||
|
||||
|
I didn't see a where clause in your sql statement.
correct format is as follows: Code:
UpdateSQL = "UPDATE product_info SET atomizer_media='" & atomizer_media & "', is_repackable='" & is_repackable & "' Where YOURPRIMARYKEYFIELDNAME = THEPRIMARYKEYFIELDTOUPDATE"
__________________
................... ASCII and ye shall receive .................. Knowledge is the only resource on earth that multiplies when shared Support the Shemzilla Project Powered by C# |
|
#4
|
|||
|
|||
|
Quote:
Sorry about that. I forgot to include it with the post. I was commenting it in and out trying to see if it was the problem Here is what I have so far, I had two or three of the fields working but now im getting the same error again Code:
UpdateSQL = "UPDATE product_info SET direct_instruct=" & "'" & new_direct_instruct & "'"
UpdateSQL = UpdateSQL & ", flush_media=" & "'" & new_flush_media & "'"
UpdateSQL = UpdateSQL & ", atomizer_media=" & "'" & new_atomizer_media & "'"
UpdateSQL = UpdateSQL & ", is_repackable=" & "'" & new_is_repackable & "'"
UpdateSQL = UpdateSQL & ", split_instruct=" & "'" & new_split_instruct & "'"
UpdateSQL = UpdateSQL & ", process_feedback=" & "'" & new_process_feedback & "'"
UpdateSQL = UpdateSQL & ", notes=" & "'" & new_notes & "'"
UpdateSQL = UpdateSQL & "WHERE w_stream=" & "'" & Ucase(Searchstring) & "'"
Set updateADODB = dbWriteConnection.Execute(UpdateSQL)
|
|
#5
|
||||
|
||||
|
Code:
UpdateSQL = "UPDATE product_info SET direct_instruct='" & new_direct_instruct & "'" UpdateSQL = UpdateSQL & ", flush_media='" & new_flush_media & "'" UpdateSQL = UpdateSQL & ", atomizer_media='" & new_atomizer_media & "'" UpdateSQL = UpdateSQL & ", is_repackable='" & new_is_repackable & "'" UpdateSQL = UpdateSQL & ", split_instruct='" & new_split_instruct & "'" UpdateSQL = UpdateSQL & ", process_feedback='" & new_process_feedback & "'" UpdateSQL = UpdateSQL & ", notes='" & new_notes & "'" UpdateSQL = UpdateSQL & "WHERE w_stream='" & Ucase(Searchstring) & "'" Set updateADODB = dbWriteConnection.Execute(UpdateSQL) |
![]() |
| Viewing: ASP Free Forums > Database > SQL Development > Updating multiple fields from the same table with unique values |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|
|