mmaz
Programmer
- Nov 22, 2000
- 347
Hello! I'm calling a CR8 report from an ASP, using an ODBC connection to SQL Server. When I call my report, it's getting all the records from the database, regardless of what I wrote in my SQL statement. I assumed that I would not need parameters with this SQL statement. Am I wrong? I want to get the records whose create_date is between 10/30/2000 and 11/02/2000. Here's my code:
Set oConn = Server.CreateObject("ADODB.Connection"
oConn.Open "DSN name","username","pwd"
set session("oRs" = server.CreateObject("ADODB.recordset"
strSQL = "SELECT * FROM tableName WHERE(Create_Date BETWEEN CONVERT(DATETIME, '2000-10-30 00:00:00', 102) AND CONVERT(DATETIME, '2000-11-02 00:00:00', 102))"
-- this should only get the records from 10/30/2000 to 11/02/2000 but the report is displaying everything in the db
session("oRs".Open strSQL,oConn
set Database = session("oRpt".database
set Tables = Database.Tables
set Table1 = Tables.Item(1)
Table1.SetLogonInfo "DSN name","tableName","username","password"
session("oRpt".DiscardSavedData
Table1.SetPrivateData 3, session("oRs"
Thanks for your help!!
Set oConn = Server.CreateObject("ADODB.Connection"
oConn.Open "DSN name","username","pwd"
set session("oRs" = server.CreateObject("ADODB.recordset"
strSQL = "SELECT * FROM tableName WHERE(Create_Date BETWEEN CONVERT(DATETIME, '2000-10-30 00:00:00', 102) AND CONVERT(DATETIME, '2000-11-02 00:00:00', 102))"
-- this should only get the records from 10/30/2000 to 11/02/2000 but the report is displaying everything in the db
session("oRs".Open strSQL,oConn
set Database = session("oRpt".database
set Tables = Database.Tables
set Table1 = Tables.Item(1)
Table1.SetLogonInfo "DSN name","tableName","username","password"
session("oRpt".DiscardSavedData
Table1.SetPrivateData 3, session("oRs"
Thanks for your help!!