Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

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

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

How to Use the Help Bell

Need to boost the visibility of your question for solutions? Use the Experts Exchange Help Bell to confirm priority levels and contact subject-matter experts for question attention.  Check out this how-to article for more information.

Question has a verified solution.

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

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…
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 tutorial will teach you the special effect of super speed similar to the fictional character Wally West aka "The Flash" After Shake : http://www.videocopilot.net/presets/after_shake/ All lightning effects with instructions : http://www.mediaf…
Visualize your data even better in Access queries. Given a date and a value, this lesson shows how to compare that value with the previous value, calculate the difference, and display a circle if the value is the same, an up triangle if it increased…

618 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