Solved

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

Posted on 2006-06-28
4
375 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
  • 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 30

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 30

Author Comment

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

Carrzkiss
0

Featured Post

Free Trending Threat Insights Every Day

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

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…
This demonstration started out as a follow up to some recently posted questions on the subject of logging in: http://www.experts-exchange.com/Programming/Languages/Scripting/JavaScript/Q_28634665.html and http://www.experts-exchange.com/Programming/…
It is a freely distributed piece of software for such tasks as photo retouching, image composition and image authoring. It works on many operating systems, in many languages.
This video explains how to create simple products associated to Magento configurable product and offers fast way of their generation with Store Manager for Magento tool.

708 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

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now