Web Wiz - Green Windows Web Hosting

  New Posts New Posts RSS Feed - Syntax error or access violation
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

Syntax error or access violation

 Post Reply Post Reply
Author
urbantruth View Drop Down
Newbie
Newbie


Joined: 17 November 2004
Status: Offline
Points: 11
Post Options Post Options   Thanks (0) Thanks(0)   Quote urbantruth Quote  Post ReplyReply Direct Link To This Post Topic: Syntax error or access violation
    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
Back to Top
urbantruth View Drop Down
Newbie
Newbie


Joined: 17 November 2004
Status: Offline
Points: 11
Post Options Post Options   Thanks (0) Thanks(0)   Quote urbantruth Quote  Post ReplyReply Direct Link To This Post 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
Back to Top
Gullanian View Drop Down
Senior Member
Senior Member
Avatar

Joined: 04 January 2002
Location: England
Status: Offline
Points: 4373
Post Options Post Options   Thanks (0) Thanks(0)   Quote Gullanian Quote  Post ReplyReply Direct Link To This Post Posted: 11 May 2006 at 10:19pm
 response.End() doesn't need () after it, that might be your syntax error
Back to Top
urbantruth View Drop Down
Newbie
Newbie


Joined: 17 November 2004
Status: Offline
Points: 11
Post Options Post Options   Thanks (0) Thanks(0)   Quote urbantruth Quote  Post ReplyReply Direct Link To This Post 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.
 
 
Back to Top
dpyers View Drop Down
Senior Member
Senior Member


Joined: 12 May 2003
Status: Offline
Points: 3937
Post Options Post Options   Thanks (0) Thanks(0)   Quote dpyers Quote  Post ReplyReply Direct Link To This Post 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

What's in MakeWhereClause?


Lead me not into temptation... I know the short cut, follow me.
Back to Top
 Post Reply Post Reply

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 12.08
Copyright ©2001-2026 Web Wiz Ltd.


Become a Fan on Facebook Follow us on X Connect with us on LinkedIn Web Wiz Blogs
About Web Wiz | Contact Web Wiz | Terms & Conditions | Cookies | Privacy Notice

Web Wiz is the trading name of Web Wiz Ltd. Company registration No. 05977755. Registered in England and Wales.
Registered office: Web Wiz Ltd, Unit 18, The Glenmore Centre, Fancy Road, Poole, Dorset, BH12 4FB, UK.

Prices exclude VAT at 20% unless otherwise stated. VAT No. GB988999105 - $, € prices shown as a guideline only.

Copyright ©2001-2026 Web Wiz Ltd. All rights reserved.