Here's what I want to do in my application. I have a form where a user is allowed to pick parameters for a query which I want to use to create a report.
On the load form event I have code which creates a default report of all records in the sql view. When I reset the dataset all goes well. The dataset clears and fills just fine. The problem is when I try to reset the report document data source and display the report with the new data.
If I create a new report document via code and use the load method I get "Load Report Failed"
If I use the existing report document I get a prompt for user id, password etc to connect to the database. However the same code on the load form event doesn't prompt for this information.
I've posted both code pieces below.... Any thoughts??
'Load Form event (works fine)
SqlSelectCommand1.CommandText = strSQL1 'command
sdaReport.Fill(dsReport) 'dataadapter
docTemp.SetDataSource(sdaReport) 'reportdocument
crvChecks.ReportSource = docTemp 'crystal report viewer
'Report Change (doesn't work)
SqlSelectCommand1.CommandText = strSQL1
dsReport.Clear()
sdaReport.Fill(dsReport)
docTemp.Load("rptChecks.rpt") 'fails here
docTemp.SetDataSource(sdaReport)
crvChecks.ReportSource = docTemp
The crystal report is included in the .exe and created dynamically at run time.
On the load form event I have code which creates a default report of all records in the sql view. When I reset the dataset all goes well. The dataset clears and fills just fine. The problem is when I try to reset the report document data source and display the report with the new data.
If I create a new report document via code and use the load method I get "Load Report Failed"
If I use the existing report document I get a prompt for user id, password etc to connect to the database. However the same code on the load form event doesn't prompt for this information.
I've posted both code pieces below.... Any thoughts??
'Load Form event (works fine)
SqlSelectCommand1.CommandText = strSQL1 'command
sdaReport.Fill(dsReport) 'dataadapter
docTemp.SetDataSource(sdaReport) 'reportdocument
crvChecks.ReportSource = docTemp 'crystal report viewer
'Report Change (doesn't work)
SqlSelectCommand1.CommandText = strSQL1
dsReport.Clear()
sdaReport.Fill(dsReport)
docTemp.Load("rptChecks.rpt") 'fails here
docTemp.SetDataSource(sdaReport)
crvChecks.ReportSource = docTemp
The crystal report is included in the .exe and created dynamically at run time.