Print Page | Close Window

Unterminated string constant Error

Printed From: Web Wiz Forums
Category: General Discussion
Forum Name: Classic ASP Discussion
Forum Description: Discussion on Active Server Pages (Classic ASP).
URL: https://forums.webwiz.net/forum_posts.asp?TID=5967
Printed Date: 30 March 2026 at 11:40pm
Software Version: Web Wiz Forums 12.08 - https://www.webwizforums.com


Topic: Unterminated string constant Error
Posted By: groq
Subject: Unterminated string constant Error
Date Posted: 25 September 2003 at 8:24am

Guys,

I'm writing some code to add records to two tables at once but I keep getting the following error message from the browser:

Unterminated string constant
/dam/da.asp, line 33, column 25

Here's the code, line 33 is commented:

<%
data_source = "Provider=Microsoft.Jet.OLEDB.4.0; Data Source=" & Server.MapPath("dam2.mdb")
con.Open data_source

Set RS = Server.CreateObject("ADODB.RecordSet")
RS.open "damm", con, 2, 2
RS.addnew
RS("fname") = request.form("fname")
RS("lname") = request.form("lname")
RS("album") = request.form("album")
RS("producer") = request.form("producer")
RS.update
RS.movelast

strID = RS("PR")
RS.Close
set RS = nothing

strSQL = "INSERT INTO damm2(PR, album, producer)"
strSQL = strSQL & PR & ", /this is line 33 of the code
strSQL = strSQL & "'" & request("album") & "',
strSQL = strSQL & "'" & request("producer") & "'
con.execute(strsql)<br>


con.Close
Set con = Nothing

 
%>

 

Any help will be greatly appreciated.

Groq



-------------
GROQ



Replies:
Posted By: kajakske
Date Posted: 25 September 2003 at 8:28am
You open your string with " but fail to close it ...

strSQL = "INSERT INTO damm2(PR, album, producer)"
strSQL = strSQL & PR & ","
strSQL = strSQL & "'" & request("album") & "',"
strSQL = strSQL & "'" & request("producer") & "'"
con.execute(strsql)


-------------
Hawkfield web development

http://www.hawkfield.be">Web design | http://hawkx.hawkfield.be">Banner Exchange



Posted By: groq
Date Posted: 25 September 2003 at 9:02am

thanks for the reply it fixed that problem but this stubborn browser spits another error message as follows:

Item cannot be found in the collection corresponding to the requested name or ordinal.
/dam/da.asp, line 24

here's the updated code, line 24 is commented:

<%
strconn = "DRIVER=Microsoft Access Driver (*.mdb);DBQ=" & Server.MapPath("dam2.mdb")
set con = server.createobject("adodb.connection")
con.Open strconn

Set RS = Server.CreateObject("ADODB.RecordSet")
RS.open "damm", con, 3, 3
RS.addnew
RS("fname") = request.form("fname")
RS("lname") = request.form("lname")
RS("album") = request.form("album") /this is line 24
RS("producer") = request.form("producer")
RS.update
RS.movelast

strID = RS("PR")
RS.Close
set RS = nothing

strSQL = "INSERT INTO damm2(PR, album, producer)"
strSQL = strSQL & PR & ","
strSQL = strSQL & "'" & request("album") & "',"
strSQL = strSQL & "'" & request("producer") & "'"
con.execute(strsql)


con.Close
Set con = Nothing

 
%>

What could the problem be now?



-------------
GROQ


Posted By: Flamewave
Date Posted: 25 September 2003 at 3:40pm

The error is telling you exactly what your problem is: it cant find the column album in the database. This is probally because your sql statment that you currently have is "damm", which is not a valid sql statement. You will need to create a select statement to select all the columns you want to update from the database.



-------------
- Flamewave

They say the grass is greener on the other side, but if you really think about it, the grass is greener on both sides.



Print Page | Close Window

Forum Software by Web Wiz Forums® version 12.08 - https://www.webwizforums.com
Copyright ©2001-2026 Web Wiz Ltd. - https://www.webwiz.net