Solved

sql syntax error ... sigh !

Posted on 2014-10-21
3
173 Views
Last Modified: 2014-10-21
I think this will be my last post of the day ...  I added an additional value to the code I have been working on (descriptions), but it gives me an error when I do .. the description is an nvarchar data type

---

<%
'-- create connection object and establish a connection to the database
set conn = Server.CreateObject("ADODB.Connection")
conn.Open MM_eimmigration_STRING

caseid = request.querystring("caseid")
itemIDs = request.form("itemid")
amounts = request.form("amount")
descriptions = request.form("itemdesc")


Caseid = Request.Querystring("caseid")  
BillsMainid = rs_topbillpymnt("MainPaymntid")
Entryby = Session("Userid")
arrItemIDs = Split( itemIDs, "," )
arrAmounts = Split( amounts, "," )
arrDescriptions = Split( descriptions, "," )

'-- now loop through the array and insert into the database
for counter = 0 to UBound( arrItemIDs )
      if arrItemIDs( counter ) <> "" then       '-- you also may want to check to make sure it's an numerical value
            sql = "insert into BillPaymntsRecvd ( BillsMainid, Entryby, itemID, PmtRecd, caseid, ItemDesc ) values (  " & (BillsMainid) & ", " & (Entryby) & "," & arrItemIDs( counter ) & ", " & arrAmounts( counter ) & " , " & (caseid) & "," & arrDescriptions( counter ) & " )"
            conn.Execute( sql )            '-- assumes you have a connection object created and connected to the database
      end if
next

if conn.State <> 0 then conn.Close
set conn = nothing
      
%>

---

The error I get is:

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

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

/bluedot/Intranet/Billing/SPSavePaymentLines.asp, line 133
0
Comment
Question by:amucinobluedot
  • 2
3 Comments
 
LVL 58

Accepted Solution

by:
Gary earned 500 total points
ID: 40395735
            sql = "insert into BillPaymntsRecvd ( BillsMainid, Entryby, itemID, PmtRecd, caseid, ItemDesc ) values (  " & (BillsMainid) & ", " & (Entryby) & "," & arrItemIDs( counter ) & ", " & arrAmounts( counter ) & " , " & (caseid) & ",'" & arrDescriptions( counter ) & "' )"

Open in new window

0
 

Author Comment

by:amucinobluedot
ID: 40395749
Thank you senor !!! I am done for the day !   :)   bless you.
0
 

Author Closing Comment

by:amucinobluedot
ID: 40395750
:)
0

Featured Post

DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

Question has a verified solution.

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

I was asked about the differences between classic ASP and ASP.NET, so let me put them down here, for reference: Let's make the introductions... Classic ASP was launched by Microsoft in 1998 and dynamically generate web pages upon user interact…
PL/SQL can be a very powerful tool for working directly with database tables. Being able to loop will allow you to perform more complex operations, but can be a little tricky to write correctly. This article will provide examples of basic loops alon…
Email security requires an ever evolving service that stays up to date with counter-evolving threats. The Email Laundry perform Research and Development to ensure their email security service evolves faster than cyber criminals. We apply our Threat…
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…

786 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