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