I just migrate my database from Access to SQL server. My previous ASP code has problem in communicating with SQL database. Here is my SQL statement:
strSQL = ""
strSQL = strSQL & "select count(Page) as Count, max(Page) as Page1 from PAGEVIEW where "
strSQL = strSQL & "[Date] between #" & fromDate & "# and #" & toDate & "# "
strSQL = strSQL & "and BookID = '" & strBookID & "' and TypeID <> 3 and TypeID <> 5 group by Page order by count(Page) desc, Page"
The error message is:
Microsoft OLE DB Provider for ODBC Drivers error '80040e14'
[Microsoft][ODBC SQL Server Driver][SQL Server]Line 1: Incorrect syntax near '#'.
Can anybody tell me what's wrong with my code.
Thanks!
strSQL = ""
strSQL = strSQL & "select count(Page) as Count, max(Page) as Page1 from PAGEVIEW where "
strSQL = strSQL & "[Date] between #" & fromDate & "# and #" & toDate & "# "
strSQL = strSQL & "and BookID = '" & strBookID & "' and TypeID <> 3 and TypeID <> 5 group by Page order by count(Page) desc, Page"
The error message is:
Microsoft OLE DB Provider for ODBC Drivers error '80040e14'
[Microsoft][ODBC SQL Server Driver][SQL Server]Line 1: Incorrect syntax near '#'.
Can anybody tell me what's wrong with my code.
Thanks!