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
Solved

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

Posted on 2006-06-28
4
390 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 Tool: Postgres Monitoring System

A PHP and Perl based system to collect and display usage statistics from PostgreSQL databases.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

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…
Have you ever needed to get an ASP script to wait for a while? I have, just to let something else happen. Or in my case, to allow other stuff to happen while I was murdering my MySQL database with an update. The Original Issue This was written…
Established in 1997, Technology Architects has become one of the most reputable technology solutions companies in the country. TA have been providing businesses with cost effective state-of-the-art solutions and unparalleled service that is designed…

791 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