Syntax error

I have a script that updates a table in the database when payments are made but I am getting a syntax error:

-- code --

<%
Response.Buffer = True

       'First, we need to get the total number of items that could be updated
       Dim iCount3
       iCount3 = Request.Form("Count")

       'We need to obtain each Link and ID
       Dim strLink3, strID3, strBalance3

Dim strSQL3
Dim Command13
set Command13 = Server.CreateObject("ADODB.Connection")
Command13.ConnectionString = MM_eimmigration_STRING
Command13.Open

Dim iLoop3
     
For iLoop3 = 0 to iCount3
    strLink3 = Request(iLoop & ".Link")
 strBalance3 = Request(iLoop & ".Balance")
    strID3 = Request(iLoop & ".ID2")
      strSQL3 = "UPDATE BillingLines SET PmtRecd = " & ccur(strBalance) + ccur(strLink) & "  " &_
      " WHERE Id = " & strID


Command13.Execute strSQL3



Next
Command13.Close
       Set Command13 = Nothing

     
%>

--   error --

Microsoft OLE DB Provider for ODBC Drivers error '80040e14'

[Microsoft][ODBC SQL Server Driver][SQL Server]Incorrect syntax near '='.

/bluedot/Intranet/Billing/Payments/PaymentSavedUpdatepaymnt.asp, line 34
LVL 1
AleksAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Big MontySenior Web Developer / CEO of ExchangeTree.org Commented:
you don't have a strID variable, I think it should be strID3:

 strSQL3 = "UPDATE BillingLines SET PmtRecd = " & ccur(strBalance) + ccur(strLink) & "  " &_
      " WHERE Id = " & strID3
0
Big MontySenior Web Developer / CEO of ExchangeTree.org Commented:
in fact, you need to add a "3" to all of your variable names:

 strSQL3 = "UPDATE BillingLines SET PmtRecd = " & ccur(strBalance3) + ccur(strLink3) & "  " &_
      " WHERE Id = " & strID3
0
Big MontySenior Web Developer / CEO of ExchangeTree.org Commented:
you're also setting yourself up to be targeted by sql injection attacks, you may want to use parameterized queries instead
0
Cloud Class® Course: Python 3 Fundamentals

This course will teach participants about installing and configuring Python, syntax, importing, statements, types, strings, booleans, files, lists, tuples, comprehensions, functions, and classes.

AleksAuthor Commented:
I did notice that typo, I added it but still get the same error:

-- code

<%
Response.Buffer = True

       'First, we need to get the total number of items that could be updated
       Dim iCount3
       iCount3 = Request.Form("Count")

       'We need to obtain each Link and ID
       Dim strLink3, strID3, strBalance3

Dim strSQL3
Dim Command3
set Command3 = Server.CreateObject("ADODB.Connection")
Command3.ConnectionString = MM_eimmigration_STRING
Command3.Open

Dim iLoop3
     
For iLoop3 = 0 to iCount3
    strLink3 = Request(iLoop & ".Link")
 strBalance3 = Request(iLoop & ".Balance")
    strID3 = Request(iLoop & ".ID2")
      strSQL3 = "UPDATE BillingLines SET PmtRecd = " & ccur(strBalance) + ccur(strLink) & "  " &_
      " WHERE Id = " & strID3


Command3.Execute strSQL3



Next
Command3.Close
       Set Command3 = Nothing

     
%>

-- error

Microsoft OLE DB Provider for ODBC Drivers error '80040e14'

[Microsoft][ODBC SQL Server Driver][SQL Server]Incorrect syntax near '='.

/bluedot/Intranet/Billing/Payments/PaymentSavedUpdatepaymnt.asp, line 34


--

Line 34 is: Command3.Execute strSQL3
0
Big MontySenior Web Developer / CEO of ExchangeTree.org Commented:
you need to fix the other variables as well:

strSQL3 = "UPDATE BillingLines SET PmtRecd = " & ccur(strBalance) + ccur(strLink) & "  " &_
      " WHERE Id = " & strID3
0
AleksAuthor Commented:
I did, same error

Microsoft OLE DB Provider for ODBC Drivers error '80040e14'

[Microsoft][ODBC SQL Server Driver][SQL Server]Incorrect syntax near '='.

/bluedot/Intranet/Billing/Payments/PaymentSavedUpdatepaymnt.asp, line 34
0
Big MontySenior Web Developer / CEO of ExchangeTree.org Commented:
did you add a 3 to the variable names i highlighted above?
0
AleksAuthor Commented:
This is the code for the whole page. Only the top part is giving issues:

----

<%@LANGUAGE="VBSCRIPT" CODEPAGE="1252"%>

-- THIS IS THE PART OF THE CODE THAT GIVES THE ERROR --

<%
Response.Buffer = True

       'First, we need to get the total number of items that could be updated
       Dim iCount3
       iCount3 = Request.Form("Count")

       'We need to obtain each Link and ID
       Dim strLink3, strID3, strBalance3

Dim strSQL3
Dim Command3
set Command3 = Server.CreateObject("ADODB.Connection")
Command3.ConnectionString = MM_eimmigration_STRING
Command3.Open

Dim iLoop3
     
For iLoop3 = 0 to iCount3
    strLink3 = Request(iLoop & ".Link")
 strBalance3 = Request(iLoop & ".Balance")
    strID3 = Request(iLoop & ".ID2")
    strSQL3 = "UPDATE BillingLines SET PmtRecd = " & ccur(strBalance) + ccur(strLink) & "  " &_
       " WHERE Id = " & strID3


Command3.Execute strSQL3



Next
Command3.Close
       Set Command3 = Nothing

     
%>


<!--#THE REST OF THE CODE WORKS FINE-->

<%
Response.Buffer = True

       'First, we need to get the total number of items that could be updated
       Dim iCount
       iCount = Request.Form("Count")

       'We need to obtain each Link and ID
       Dim strLink, strID

Dim strSQL
Dim Command1
set Command1 = Server.CreateObject("ADODB.Connection")
Command1.ConnectionString = MM_eimmigration_STRING
Command1.Open

Dim iLoop
     
For iLoop = 0 to iCount
    strLink = Request(iLoop & ".Link")
    strID = Request(iLoop & ".ID")
      strSQL = "UPDATE BillPaymntsRecvd SET PmtRecd = " & strLink & "  " &_
      " WHERE PaymntId = " & strID
 

Command1.Execute strSQL
Next

Command1.Close
       Set Command1 = Nothing

       
%>



<html>
<head>
<title>Registering Payment</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<META HTTP-EQUIV="Expires" CONTENT="-1">
<META HTTP-EQUIV="Pragma" CONTENT="no-cache">
<META HTTP-EQUIV="Cache-Control" CONTENT="no-cache">
<link href="../../../css/home.css" rel="stylesheet" type="text/css">
</head>


<body>
<div align="center">
  <p class="bodytext">&nbsp;</p>
  <p class="bodytext">&nbsp;</p>
  <p class="bodytext">Please wait ... registering payment </p>

</div>
</body>
</html>

<!--#BeginBlock-->

<script language="javascript">
window.location.href="../UpdatePayments.asp";
</script>
0
Big MontySenior Web Developer / CEO of ExchangeTree.org Commented:
for the third time then, change

strSQL3 = "UPDATE BillingLines SET PmtRecd = " & ccur(strBalance) + ccur(strLink) & "  " &_
       " WHERE Id = " & strID3

to

strSQL3 = "UPDATE BillingLines SET PmtRecd = " & ccur(strBalance3) + ccur(strLink3) & "  " &_
       " WHERE Id = " & strID3
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
AleksAuthor Commented:
In fact it was the iloop that needed the 3 added. No errors now but it is not updating the table values  :#
0
AleksAuthor Commented:
Thanks for the patience !
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
ASP

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.