Can someone take a look at this and possibly tell me what I'm missing here?

<!-- #includes file="DBConnect.inc" -->

<% 
	u_CDNum=request.form("u_CDNum")
	u_CDDesc=request.form("u_CDDesc")
	u_CDStock=request.form("u_CDStock")
%>

<%
SQL = "INSERT INTO CDNumber (nCDNumber, tCDDescription, bStockorMiscImages) 
VALUES ('"&u_CDNum&"','"&u_CDDesc&"','"&u_CDStock&"')"
conn.Execute(SQL)
%>

Get's this:

Microsoft VBScript compilation error '800a0409'

Unterminated string constant

/rsd_image_library/X/input_text_to_db.asp, line 12

SQL = "INSERT INTO CDNumber (nCDNumber, tCDDescription, bStockorMiscImages)
---------------------------------------------------------------------------^

Recommended Answers

All 2 Replies

You have the SQL statement in two
separate lines. VBScript is interpreting the end of line as the end of statement.
You can:
a. remove the new line character so that all in on a single line

SQL = "INSERT INTO CDNumber (nCDNumber, tCDDescription, bStockorMiscImages) VALUES ('"&u_CDNum&"','"&u_CDDesc&"','"&u_CDStock&"')"

OR
b. append and underscore at the end of the first line so that when VBSCRIPT sees it, it knows the statent continues on the next line.

SQL = "INSERT INTO CDNumber (nCDNumber, tCDDescription, bStockorMiscImages) _
VALUES ('"&u_CDNum&"','"&u_CDDesc&"','"&u_CDStock&"')"

D'oh, I was hoping it was something like that. I'd been looking at it too long to see very clear.

Thanks!

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.