Solved

ASP and Updates

Posted on 1998-10-01
5
179 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

Tutorials alone can't teach real engineering

So we built better training tools.

-Hands-on Labs
-Instructor Mentoring
-Scenario-Based Tests
-Dedicated Cloud Servers

All at your fingertips. What are you waiting for?

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Developer portfolios can be a bit of an enigma—how do you present yourself to employers without burying them in lines of code?  A modern portfolio is more than just work samples, it’s also a statement of how you work.
When it comes to security, close monitoring is a must. According to WhiteHat Security annual report, a substantial number of all web applications are vulnerable always. Monitis offers a new product - fully-featured Website security monitoring and pr…
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
This video teaches users how to migrate an existing Wordpress website to a new domain.

690 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