Solved

ASP and Updates

Posted on 1998-10-01
5
174 Views
Last Modified: 2013-12-25
I am trying to write an Update Statement to update a SQL table. What I have doesn't seem to work. Any advice would be helpful.

sql = "UPDATE Individual SET " &_
"vchAddress1 = " & (Session("Address1") ,",") & _
"vchAddress2 = " & (Session("Address2"), ",") &_
"vchAddress3 = " & (Session("Address3"), ",") &_
"vchCity = " & (Session("City"), ",") &_
"vchRegionCode = " & (Session("State"), ",") &_
"vchPostCode = " & (Session("Zip"), ",") &_
"vchEmailAddress = " & (Session("Email"), "") &_
Set rsDBC = DBC.Execute(sql)

0
Comment
Question by:yolish
  • 3
  • 2
5 Comments
 

Accepted Solution

by:
AnitaP earned 50 total points
ID: 1855370
Try :

sql = "UPDATE Individual SET "
sql = sql + "vchAddress1 = " & (Session("Address1") ,",")
sql = sql + "vchAddress2 = " & (Session("Address2"), ",")
sql = sql + "vchAddress3 = " & (Session("Address3"), ",")
sql = sql + "vchCity = " & (Session("City"), ",")
sql = sql + "vchRegionCode = " & (Session("State"), ",")
sql = sql + "vchPostCode = " & (Session("Zip"), ",")
sql = sql + "vchEmailAddress = " & (Session("Email"), "")

Set rsDBC = DBC.Execute(sql)
0
 

Author Comment

by:yolish
ID: 1855371
Anita-

I am getting this error, which is the same error I was getting before.

Microsoft VBScript compilation error '800a03ee'

Expected ')'

/NORMA/Account/DemoUpdate.asp, line 36

sql = sql + "vchAddress1 = " & (Session("Address1") ,",")
----------------------------------------------------^

0
 

Author Comment

by:yolish
ID: 1855372
Actually the errror is occuring at the first , after the ("Address1")
0
 

Expert Comment

by:AnitaP
ID: 1855373
Unfortunatlely I am not yet familiar with the session variable but these are the best guesses that I can give:

sql = sql + "vchAddress1 = " & Session('Address1') & ","
.
Try it like that. Don't forget to change for each line. Make them all the same. If it doesn't work, I'd suggest that you eliminate some code. Try this first if it works then add another line of code.
sql = sql + "vchAddress1 = " & Session('Address1') & ","

0
 

Author Comment

by:yolish
ID: 1855374
Actually here is the code that works.
sql = "UPDATE Individual SET "  
      sql = sql & "vchAddress1 = '" & Session("Address1") & "', "
      sql = sql & "vchAddress2 = '" & Session("Address2") & "', "
    sql = sql & "vchAddress3 = '" & Session("Address3") & "', "
    sql = sql & "vchCity = '" & Session("City") & "', "
    sql = sql & "vchRegionCode = '" & Session("State") & "', "
    sql = sql & "vchPostCode = '" & Session("Zip") & "', "
    sql = sql & "vchEmailAddress = '" & (Session("Email") & "'")
      DBC.Execute(sql)

0

Featured Post

Maximize Your Threat Intelligence Reporting

Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

Join & Write a Comment

Uploading files to the web server has become common part of almost any kind of web application. People use different technologies to solve this, but regardless of the technology used, it is always useful to have some kind of progress indicator shown…
Using SQL Scripts we can save all the SQL queries as files that we use very frequently on our database later point of time. This is one of the feature present under SQL Workshop in Oracle Application Express.
The viewer will learn how to dynamically set the form action using jQuery.
The viewer will get a basic understanding of what section 508 compliance can entail, learn about skip navigation links, alt text, transcripts, and font size controls.

707 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now