Web Wiz - Green Windows Web Hosting

  New Posts New Posts RSS Feed - Unterminated string constant Error
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

Unterminated string constant Error

 Post Reply Post Reply
Author
groq View Drop Down
Newbie
Newbie
Avatar

Joined: 21 July 2003
Location: United States
Status: Offline
Points: 14
Post Options Post Options   Thanks (0) Thanks(0)   Quote groq Quote  Post ReplyReply Direct Link To This Post Topic: Unterminated string constant Error
    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

Back to Top
kajakske View Drop Down
Newbie
Newbie
Avatar

Joined: 10 January 2003
Location: Belgium
Status: Offline
Points: 21
Post Options Post Options   Thanks (0) Thanks(0)   Quote kajakske Quote  Post ReplyReply Direct Link To This Post 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)


Edited by kajakske
Back to Top
groq View Drop Down
Newbie
Newbie
Avatar

Joined: 21 July 2003
Location: United States
Status: Offline
Points: 14
Post Options Post Options   Thanks (0) Thanks(0)   Quote groq Quote  Post ReplyReply Direct Link To This Post 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?

Back to Top
Flamewave View Drop Down
Senior Member
Senior Member
Avatar

Joined: 19 June 2002
Location: United States
Status: Offline
Points: 376
Post Options Post Options   Thanks (0) Thanks(0)   Quote Flamewave Quote  Post ReplyReply Direct Link To This Post 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.
Back to Top
 Post Reply Post Reply

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 12.08
Copyright ©2001-2026 Web Wiz Ltd.


Become a Fan on Facebook Follow us on X Connect with us on LinkedIn Web Wiz Blogs
About Web Wiz | Contact Web Wiz | Terms & Conditions | Cookies | Privacy Notice

Web Wiz is the trading name of Web Wiz Ltd. Company registration No. 05977755. Registered in England and Wales.
Registered office: Web Wiz Ltd, Unit 18, The Glenmore Centre, Fancy Road, Poole, Dorset, BH12 4FB, UK.

Prices exclude VAT at 20% unless otherwise stated. VAT No. GB988999105 - $, € prices shown as a guideline only.

Copyright ©2001-2026 Web Wiz Ltd. All rights reserved.