[Last Call] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

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

Posted on 2006-06-28
4
Medium Priority
?
448 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 31

Author Comment

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

How can I fix this?
0
 
LVL 18

Accepted Solution

by:
Morcalavin earned 500 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

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

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…
Hello, all! I just recently started using Microsoft's IIS 7.5 within Windows 7, as I just downloaded and installed the 90 day trial of Windows 7. (Got to love Microsoft for allowing 90 days) The main reason for downloading and testing Windows 7 is t…
This Micro Tutorial will teach you how to add a cinematic look to any film or video out there. There are very few simple steps that you will follow to do so. This will be demonstrated using Adobe Premiere Pro CS6.
When cloud platforms entered the scene, users and companies jumped on board to take advantage of the many benefits, like the ability to work and connect with company information from various locations. What many didn't foresee was the increased risk…
Suggested Courses
Course of the Month18 days, 1 hour left to enroll

829 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