Web Wiz - Green Windows Web Hosting

  New Posts New Posts RSS Feed - Help! Expected end of statement
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

Help! Expected end of statement

 Post Reply Post Reply Page  123>
Author
Greaser View Drop Down
Newbie
Newbie


Joined: 30 October 2002
Location: United States
Status: Offline
Points: 26
Post Options Post Options   Thanks (0) Thanks(0)   Quote Greaser Quote  Post ReplyReply Direct Link To This Post Topic: Help! Expected end of statement
    Posted: 17 July 2003 at 9:05pm

I have been working on this isssue for the last 12 hours and need help.... 

I am getting the following error:

Error Type:
Microsoft VBScript compilation (0x800A0401)
Expected end of statement
/lab/test/testTicker.asp, line 38, column 177
strTicker = "insert into ticker1 values ('" & request.QueryString("line") & "'), ('" & request.QueryString("text") & "') WHERE line =('" & request.QueryString("line") & "')";
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------^

<%
'Dimension variables
Dim adoCon    'Holds the Database Connection Object
Dim rsUpdateEntry 'Holds the recordset for the record to be updated
Dim strSQL   'Holds the SQL query for the database
Dim lngRecordNo  'Holds the record number to be updated
Dim BuildType

'Read in the record number to be updated
lngRecordNo = CLng(Request.Form("ID_no"))

'Create an ADO connection odject
Set adoCon = Server.CreateObject("ADODB.Connection")

'Set an active connection to the Connection object using a DSN-less connection
adoCon.Open "DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=" & Server.MapPath("ticker.mdb")

'Create an ADO recordset object
Set rsUpdateEntry = Server.CreateObject("ADODB.Recordset")

'Initialise the strSQL variable with an SQL statement to query the database
strTicker = "insert into ticker1  values ('" & request.QueryString("line")  & "'), ('" & request.QueryString("text")  & "') WHERE line =('" & request.QueryString("line")  & "')"

'Set the cursor type we are using so we can navigate through the recordset
rsUpdateEntry.CursorType = 2

'Set the lock type so that the record is locked by ADO when it is updated
rsUpdateEntry.LockType = 3

'Open the tblComments table using the SQL query held in the strSQL varaiable
rsUpdateEntry.Open strTicker, adoCon

'Update the record in the recordset
rsUpdateEntry.Fields("line") =  request.querystring("line")


'Write the updated recordset to the database
rsUpdateEntry.Update

'Reset server objects
rsUpdateEntry.Close
Set rsUpdateEntry = Nothing
Set adoCon = Nothing


'Return to the update select page incase another record needs deleting
Response.Redirect "tAdmin.asp"

%>

Any help wold be appreciated....thanks in advance.

 

 

Back to Top
KCWebMonkey View Drop Down
Senior Member
Senior Member
Avatar
Go Chiefs!

Joined: 21 June 2002
Status: Offline
Points: 1319
Post Options Post Options   Thanks (0) Thanks(0)   Quote KCWebMonkey Quote  Post ReplyReply Direct Link To This Post Posted: 17 July 2003 at 9:18pm
don't you need another quote at the end to end the strTicker string?
Back to Top
Greaser View Drop Down
Newbie
Newbie


Joined: 30 October 2002
Location: United States
Status: Offline
Points: 26
Post Options Post Options   Thanks (0) Thanks(0)   Quote Greaser Quote  Post ReplyReply Direct Link To This Post Posted: 17 July 2003 at 9:28pm
Nope - that didn't work.  Thanks though.
Back to Top
MorningZ View Drop Down
Senior Member
Senior Member
Avatar

Joined: 06 May 2002
Location: United States
Status: Offline
Points: 1793
Post Options Post Options   Thanks (0) Thanks(0)   Quote MorningZ Quote  Post ReplyReply Direct Link To This Post Posted: 17 July 2003 at 9:33pm
learn how to code an INSERT statement.. there is no place for "where" clauses
Contribute to the working anarchy we fondly call the Internet
Back to Top
MorningZ View Drop Down
Senior Member
Senior Member
Avatar

Joined: 06 May 2002
Location: United States
Status: Offline
Points: 1793
Post Options Post Options   Thanks (0) Thanks(0)   Quote MorningZ Quote  Post ReplyReply Direct Link To This Post Posted: 17 July 2003 at 9:34pm
Contribute to the working anarchy we fondly call the Internet
Back to Top
Greaser View Drop Down
Newbie
Newbie


Joined: 30 October 2002
Location: United States
Status: Offline
Points: 26
Post Options Post Options   Thanks (0) Thanks(0)   Quote Greaser Quote  Post ReplyReply Direct Link To This Post Posted: 17 July 2003 at 9:42pm

I have been learning my SQL ... yes... that is why I am asking for help because I know my syntax is not right.

I have changed me code and am still receiving :

strTicker = "insert into ticker1  values ('" & request.QueryString("line")  & "'), ('" & request.QueryString("text")  & "')" ;

Error Type:
Microsoft VBScript compilation (0x800A0401)
Expected end of statement
/lab/test/testTicker.asp, line 38, column 125
strTicker = "insert into ticker1 values ('" & request.QueryString("line") & "'), ('" & request.QueryString("text") & "')" ;
----------------------------------------------------------------------------------------------------------------------------^

Any Ideas?

Back to Top
Greaser View Drop Down
Newbie
Newbie


Joined: 30 October 2002
Location: United States
Status: Offline
Points: 26
Post Options Post Options   Thanks (0) Thanks(0)   Quote Greaser Quote  Post ReplyReply Direct Link To This Post Posted: 17 July 2003 at 11:15pm

Thanks for everyones help on this.

I am now sooooo close I can taste it.

 

Here is my error now.

Error Type:
Microsoft VBScript runtime (0x800A01A8)
Object required: ''
/lab/test/testTicker.asp, line 32
 

Line 32 is highlighted in red.

<%
'Dimension variables
Dim adoCon    'Holds the Database Connection Object
Dim rsUpdateEntry 'Holds the recordset for the record to be updated
Dim strSQL   'Holds the SQL query for the database
Dim lngRecordNo  'Holds the record number to be updated


'Create an ADO connection odject
Set adoCon = Server.CreateObject("ADODB.Connection")

'Set an active connection to the Connection object using a DSN-less connection
adoCon.Open "DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=" & Server.MapPath("ticker.mdb")

'Initialise the strSQL variable with an SQL statement to query the database
strSQL = "UPDATE ticker1 SET line = '" & request.QueryString("line") & "', text = 'this is a test'   WHERE line = '" & request.QueryString("line") &"';"

'Open the tblComments table using the SQL query held in the strSQL varaiable
rsUpdateEntry.Open strSQL, adoCon

'rsUpdateEntry.Fields("line") =  request.querystring("line")
rsUpdateEntry.Fields("text") =  request.querystring("text")

'Return to the update select page incase another record needs deleting
Response.Redirect "tAdmin.asp"


Set adoCon = nothing
%>

 

Thanks again for the help in advance.

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

Joined: 06 May 2002
Location: United States
Status: Offline
Points: 1793
Post Options Post Options   Thanks (0) Thanks(0)   Quote MorningZ Quote  Post ReplyReply Direct Link To This Post Posted: 18 July 2003 at 5:35am

its help if we knew what the heck you were trying to do...

so far with the same piece of code, i've seen you try to insert, i've seen you try to update, and i dont know what the ___ you are trying to later on.... its all wrong....

i'll try to help with a little from earlier:

strTicker = "insert into ticker1  values ('" & request.QueryString("line")  & "'), ('" & request.QueryString("text")  & "')" ;

not sure where you got that sytax from, but you need to either (1) burn that book, or (2) wipe that bookmark off your hard drive, and then check out the syntax on the link i have above

its:
INSERT INTO Table_Name_Goes_Here ( Column1_to_Insert, Col2_to_Insert, Col3_to_Insert ) VALUES ( Col1_Value, Col2_Value, Col3_Value )

with the ColX_to_Insert NOT having quotes around them, and the ColX_Value having quotes depending on what kind of data field

trust me man, take 20 mins of your time and go through the tutorials at http://www.w3schools.com/sql/default.asp, you'll save yourself soooooooooooooooo much frustration of just randomly trying stuff (and failing miserably)

Contribute to the working anarchy we fondly call the Internet
Back to Top
 Post Reply Post Reply Page  123>

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.