Solved

[Microsoft][ODBC SQL Server Driver][SQL Server]Line 1: Incorrect syntax near '='.

Posted on 2006-06-28
4
406 Views
Last Modified: 2008-02-01
When I am using the following Code to Track Visitors (For displaying that last viewed pages to them)
Doing a [Search] (or) using the Side Navigation Tree, I receive the following Error:
(But, viewing the page without doing a [Search] (or) using the Side Navigation Tree, everything works fine)

Any Idea's on what is going wrong here?
Thank You
Carrzkiss

============================================================
Microsoft OLE DB Provider for ODBC Drivers error '80040e14'

[Microsoft][ODBC SQL Server Driver][SQL Server]Line 1: Incorrect syntax near '='.

/Visitor_Tracker.asp, line 9
============================================================

-------------Here is the code for the Visitor_Tracking.asp------------------
The following Code is by: [CyrexCore2k];
I have asked him to assist in this issue since it is his code, and have not heard anything back from him.
Since receiving the Error on: 06/24/2006
Set adoRecords = Vconn.Execute(sRecords) '<-- This is Line 9
============================================================

<%
'Dim sRecords, adoDBConn

Set adoDBConn = Server.CreateObject("ADODB.Connection")
myPath = "Provider=SQLOLEDB;Data Source=Carrz-DC;Database=CFF_Affiliate;User ID=sa;Password=carrzkiss8;"
adoDBConn.Open "Driver={SQL Server};Server=Carrz-DC;Database=CFF_Affiliate;Uid=sa;Pwd=carrzkiss8;"

sRecords = "SELECT contentid, catid, pname, thumbnail FROM content WHERE contentid = " & Request.QueryString("ContentID")
Set adoRecords = Vconn.Execute(sRecords) '<-- This is Line 9
If Not adoRecords.EOF Then
     sRecords = "SELECT count(contentid) as total FROM navigation_tracking WHERE user_session_id = '" & userSessionID & "' AND contentid = " & adoRecords.Fields("contentid")
      If adoDBConn.Execute(sRecords).Fields("total") = 0 Then
sRecords = "INSERT INTO navigation_tracking (user_session_id, viewedat, contentid, catid, pname, thumbnail) VALUES(" & _
                       "'" & userSessionID & "', " & _
                       "getdate(), " & _
                       adoRecords.Fields("contentid") & ", " & _
                       adoRecords.Fields("catid") & ", " & _
                       "'" & adoRecords.Fields("PName") & "', " & _
                       "'" & adoRecords.Fields("Thumbnail") & "')"

           adoDBConn.Execute sRecords
     Else
           sRecords = "UPDATE navigation_tracking SET viewedat = getDate() WHERE user_session_id = '" & usersessionid & "' AND ContentID = " & adoRecords.Fields("contentid")
           adoDBConn.Execute sRecords
     End If
End If


%>
============================================================
0
Comment
Question by:Wayne Barron
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
4 Comments
 
LVL 23

Expert Comment

by:apresto
ID: 17002510
the value returned by Request.QueryString("ContentID") is empty by the looks of things - so your sql is just

SELECT contentid, catid, pname, thumbnail FROM content WHERE contentid =

it has not value for the =
0
 
LVL 31

Author Comment

by:Wayne Barron
ID: 17002575
Thank you [apresto]

How can I fix this?
0
 
LVL 18

Accepted Solution

by:
Morcalavin earned 125 total points
ID: 17002832
Try this:
sRecords = "SELECT contentid, catid, pname, thumbnail FROM content WHERE contentid = '" & Request.QueryString("ContentID") & "'"
0
 
LVL 31

Author Comment

by:Wayne Barron
ID: 17002949
Thank you Calavin;
Worked like a charm.

Carrzkiss
0

Featured Post

On Demand Webinar - Networking for the Cloud Era

This webinar discusses:
-Common barriers companies experience when moving to the cloud
-How SD-WAN changes the way we look at networks
-Best practices customers should employ moving forward with cloud migration
-What happens behind the scenes of SteelConnect’s one-click button

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

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…
I would like to start this tip/trick by saying Thank You, to all who said that this could not be done, as it forced me to make sure that it could be accomplished. :) To start, I want to make sure everyone understands the importance of utilizing p…
There's a multitude of different network monitoring solutions out there, and you're probably wondering what makes NetCrunch so special. It's completely agentless, but does let you create an agent, if you desire. It offers powerful scalability …
This is my first video review of Microsoft Bookings, I will be doing a part two with a bit more information, but wanted to get this out to you folks.

688 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