Print Page | Close Window

Syntax error or access violation

Printed From: Web Wiz Forums
Category: General Discussion
Forum Name: Classic ASP Discussion
Forum Description: Discussion on Active Server Pages (Classic ASP).
URL: https://forums.webwiz.net/forum_posts.asp?TID=19827
Printed Date: 29 March 2026 at 4:18pm
Software Version: Web Wiz Forums 12.08 - https://www.webwizforums.com


Topic: Syntax error or access violation
Posted By: urbantruth
Subject: Syntax error or access violation
Date Posted: 11 May 2006 at 7:00pm
So i'm trying to select some content out of sql. I get this error:
 
Error Type:
Microsoft OLE DB Provider for SQL Server (0x80040E14)
Syntax error or access violation
/Includes/dbfunctions1.asp, line 89
 
I wrote out the actaul sql string and tested it and it works in the database. So I'm not sure what the problem is.
 
it's all inline sql so it's not a rights issue with the stored proc and it has permission with the table.
 
Here is the atual sql:
 
SELECT DISTINCT dbo.tblEvents.EventID, dbo.tblEvents.EventTitle, dbo.tblEvents.EventTeaserShort, dbo.tblEventDates.EventDate, dbo.tblEvents.EventTimeStart FROM dbo.tblEvents INNER JOIN dbo.tblEventDates ON dbo.tblEvents.EventID = dbo.tblEventDates.EventID WHERE tblEventDates.EventDate Between '5/20/2006' And '5/26/2006' Order By dbo.tblEventDates.EventDate, dbo.tblEvents.EventTimeStart
 
Here is the ASP (this is where i think the problem is):
 
Function GetRecords()
'on error resume next
 Set m_rsEvents = server.CreateObject("Adodb.Recordset")
  
 Dim cmd
 Dim strQuery
 strQuery = "SELECT DISTINCT  dbo.tblEvents.EventID, dbo.tblEvents.EventTitle, dbo.tblEvents.EventTeaserShort, dbo.tblEventDates.EventDate, dbo.tblEvents.EventTimeStart "
 strQuery = strQuery & "FROM  dbo.tblEvents INNER JOIN dbo.tblEventDates ON dbo.tblEvents.EventID = dbo.tblEventDates.EventID WHERE "
 strQuery = strQuery & MakeWhereClause
 strQuery = strQuery & " Order By dbo.tblEventDates.EventDate, dbo.tblEvents.EventTimeStart"
  
 Set cmd = Server.CreateObject("ADODB.Command")
 cmd.ActiveConnection = oConn
 cmd.CommandType = adCmdText
 cmd.CommandText = strQuery
 Response.Write cmd.CommandText
 response.End()
 Set m_rsEvents = GetReadOnlyRecordset(cmd)
 

 Set cmd = Nothing
End Function



Replies:
Posted By: urbantruth
Date Posted: 11 May 2006 at 7:01pm

I'm still kind of new to this so if you have recomendations that would be great.

 
Thanks for any help.
Mark


Posted By: Gullanian
Date Posted: 11 May 2006 at 10:19pm
 response.End() doesn't need () after it, that might be your syntax error


Posted By: urbantruth
Date Posted: 11 May 2006 at 11:40pm
oops don't count the response.write and response.end.
that was just so i could see what the sql string was.
without it, still dosen't work.
 
 


Posted By: dpyers
Date Posted: 12 May 2006 at 12:08am
That's kind of a generic bad syntax error. Can have a couple of other causes though. This page covers most of the possible causes
http://forums.webwiz.net/forum_posts.asp?TID=19827 - http://forums.webwiz.net/forum_posts.asp?TID=19827

What's in MakeWhereClause?



-------------

Lead me not into temptation... I know the short cut, follow me.



Print Page | Close Window

Forum Software by Web Wiz Forums® version 12.08 - https://www.webwizforums.com
Copyright ©2001-2026 Web Wiz Ltd. - https://www.webwiz.net