Solved

ASP and Updates

Posted on 1998-10-01
5
178 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

MS Dynamics Made Instantly Simpler

Make Your Microsoft Dynamics Investment Count  & Drastically Decrease Training Time by Providing Intuitive Step-By-Step WalkThru Tutorials.

Question has a verified solution.

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

FAQ pages provide a simple way for you to supply and for customers to find answers to the most common questions about your company. Here are six reasons why your company website should have a FAQ page
Today, the web development industry is booming, and many people consider it to be their vocation. The question you may be asking yourself is – how do I become a web developer?
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.

739 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