• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 185
  • Last Modified:

ASP and Updates

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
yolish
Asked:
yolish
  • 3
  • 2
1 Solution
 
AnitaPCommented:
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
 
yolishAuthor Commented:
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
 
yolishAuthor Commented:
Actually the errror is occuring at the first , after the ("Address1")
0
 
AnitaPCommented:
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
 
yolishAuthor Commented:
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

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

  • 3
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now