Thank you!
But I have a new problem now. I am using report document and dataadapter to fill the dataset.
Even though I have a SQL Query for the dataset, it pulls all the rows from the table.
Below is the code.
Code:
dbConnection.Open()
Dim Report As New CrystalDecisions.CrystalReports.Engine.ReportDocument
Dim sqlAdap, fname As String
Report.Load(Server.MapPath("SR.rpt"), CrystalDecisions.Shared.OpenReportMethod.OpenReportByDefault)
sqlAdap = "SELECT STARTDATE, ENDDATE, PREPAREDBY, PREPAREDDATE, AMOUNT, CURRENCY FROM SREPORTS WHERE CYID = '" & PID & "' AND STARTDATE = '" & SDate & "' AND ENDDATE = '" & EDate & "'"
Dim DSresults = New System.Data.DataSet()
Dim Adap As New System.Data.OleDb.OleDbDataAdapter()
Adap.SelectCommand = New System.Data.OleDb.OleDbCommand(sqlAdap, dbConnection)
Adap.Fill(DSresults, "SR")
fname = "C:\Rpts\SR" & PID & ".PDF"
Report.SetDataSource(DSresults)
Report.SetDatabaseLogon(USR, PWD)
Report.ExportToDisk(CrystalDecisions.Shared.ExportFormatType.PortableDocFormat, fname)