Thursday, July 30, 2009

Help Please... ASP & VB .NET and Dynamic Crystal Reports?

I need to use SQL Server 2005 stored procedure with parameters as a datasource for my report.





I tried creating an xml file of a dataset that used the stored procedure as a datasource. I also tried using the report document's SetParameterValue() to set the parameters. However, the report does not display.





Can someone please walk me through the entire process? You can e-mail me if you like. I am at a new job; and, this is my probationary period.





In the following code, I already added the parameters to the SQLCommand object (myCommand):








Dim myAdapter As SqlDataAdapter





'Dim myDataset As dsCheckTimeOff


Dim myDataSet As DataSet








myAdapter = New SqlDataAdapter(myCommand)








myDataSet = New DataSet


myDataSet.Clear()





myAdapter.Fill(myDataset)





If myDataSet.Tables(0).Rows.Count %26gt; 0 Then


myGridView.DataSource = myDataSet


myGridView.DataBind()











myReportDocument = New CrystalDecisions.CrystalReports.Engine.R...





myReportDocument.Load("C:\rptTest_2_24_0...





'***************************************...





myReportDocument.SetParameterValue("@Sel... "All")


myReportDocument.SetParameterValue("@Sup... "1200")


myReportDocument.SetParameterValue("@Sta... 2 / 1 / 2008)


myReportDocument.SetParameterValue("@End... 2008 - 2 - 29)


myReportDocument.Load("C:\rptTest_2_24_0...








myReportDocument.SetDataSource(myDataSet...





CrystalReportViewer1.ReportSource = myReportDocument


CrystalReportViewer1.DataBind()


'CrystalReportViewer1.DisplayToolbar = False





CrystalReportViewer1.Visible = True

Help Please... ASP %26amp; VB .NET and Dynamic Crystal Reports?
you are going about this wrong.. your crystal report will have an option to specify a database.. and in there you can pick what stored procedure you want to to use as a data source for your crystal report.. again.. the stored procedure goes IN your crystal and NOT in your vb.net..





in the vb.net code you will need to send crystal your report parameters... then crystal takes those params and calls the stored procedure.





http://www.thescarms.com/dotnet/CrystalP...





good luck


No comments:

Post a Comment