Solved

sql syntax error ... sigh !

Posted on 2014-10-21
3
168 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
Comment Utility
            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
Comment Utility
Thank you senor !!! I am done for the day !   :)   bless you.
0
 

Author Closing Comment

by:amucinobluedot
Comment Utility
:)
0

Featured Post

Do You Know the 4 Main Threat Actor Types?

Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

Join & Write a Comment

I recently decide that I needed a way to make my pages scream on the net.   While searching around how I can accomplish this I stumbled across a great article that stated "minimize the server requests." I got to thinking, hey, I use more than one…
Composite queries are used to retrieve the results from joining multiple queries after applying any filters. UNION, INTERSECT, MINUS, and UNION ALL are some of the operators used to get certain desired results.​
Internet Business Fax to Email Made Easy - With eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…
This tutorial demonstrates a quick way of adding group price to multiple Magento products.

743 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

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now