Solved

ASP and Updates

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

Master Your Team's Linux and Cloud Stack!

The average business loses $13.5M per year to ineffective training (per 1,000 employees). Keep ahead of the competition and combine in-person quality with online cost and flexibility by training with Linux Academy.

Question has a verified solution.

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

Suggested Solutions

An enjoyable and seamless user experience can go a long way on an eCommerce site. While a cohesive layout and engaging copy play roles in creating a positive user experience, some sites neglect aspects that seem marginal but in actuality prove very …
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.
This tutorial walks through the best practices in adding a local business to Google Maps including how to properly search for duplicates, marker placement, and inputing business details. Login to your Google Account, then search for "Google Mapmaker…
Any person in technology especially those working for big companies should at least know about the basics of web accessibility. Believe it or not there are even laws in place that require businesses to provide such means for the disabled and aging p…

770 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