Crystal Reports Hell
-
I own a small-potatoes business developing software. I am working on a new WinForms product and need flexible reports with a min. budget. I chose Crystal Reports because it came with VS .NET ("free"). I never used the product before (questionable decision), but figured I could learn it. Anyway, my original grandiose plan required that reports: 1) Display data output from a stored procedure 2) Have fields disappear or drop-out from the report based on user's security level 3) Have dynamically built selection fields based on home-grown ad-hoc tool. It appears that #2 and #3 are impossible, or, maybe can only be accomplished if I use all formula fields, and create a report with 1 field, another with 2 fields, another with 3 fields… etc. Then however many fields I want in my report, I choose the appropriate fields count report? – YUK. I cannot even get #1 working!! * When I create the report, it appears I need an SQL command (or procedure) to generate fields. * I drag these fields onto the report. * The user builds a where clause via a tool I created, and an SP is run with appropriate results. * I assign the results to the report like this: rpt.Load() rpt.SetDataSource(ds) … OR … rpt.Database.Tables.Item(0).SetDataSource(ds) rptViewer.ReportSource = rpt * The data show is always whatever was returned from the query at DESIGN tim. The dataset assigned at run tim is ignored * I did see suggestions ion the web stating to “Uncheck Save Data With Report on the file menu”. I cannot find this option. ANY HELP? Thanks, -Len Miller "If I had eight hours to chop down a tree, I'd spend six sharpening my axe." -Abraham Lincoln
-
I own a small-potatoes business developing software. I am working on a new WinForms product and need flexible reports with a min. budget. I chose Crystal Reports because it came with VS .NET ("free"). I never used the product before (questionable decision), but figured I could learn it. Anyway, my original grandiose plan required that reports: 1) Display data output from a stored procedure 2) Have fields disappear or drop-out from the report based on user's security level 3) Have dynamically built selection fields based on home-grown ad-hoc tool. It appears that #2 and #3 are impossible, or, maybe can only be accomplished if I use all formula fields, and create a report with 1 field, another with 2 fields, another with 3 fields… etc. Then however many fields I want in my report, I choose the appropriate fields count report? – YUK. I cannot even get #1 working!! * When I create the report, it appears I need an SQL command (or procedure) to generate fields. * I drag these fields onto the report. * The user builds a where clause via a tool I created, and an SP is run with appropriate results. * I assign the results to the report like this: rpt.Load() rpt.SetDataSource(ds) … OR … rpt.Database.Tables.Item(0).SetDataSource(ds) rptViewer.ReportSource = rpt * The data show is always whatever was returned from the query at DESIGN tim. The dataset assigned at run tim is ignored * I did see suggestions ion the web stating to “Uncheck Save Data With Report on the file menu”. I cannot find this option. ANY HELP? Thanks, -Len Miller "If I had eight hours to chop down a tree, I'd spend six sharpening my axe." -Abraham Lincoln
I only use Store Procedure to Edit data in SQL Server. You should use Commang SQL to Crystal Report, with Command: Public Function LayDuLieuDT(ByVal strSQL As String, ByVal table_name As String) As DataTable Try Dim oAdater As SqlClient.SqlDataAdapter Dim oTable As New DataTable Dim ds As New DataSet oAdater = New SqlClient.SqlDataAdapter(strSQL, strConn) oAdater.Fill(ds, table_name) oTable = ds.Tables(table_name) Return oTable Catch End Try End Function
-
I only use Store Procedure to Edit data in SQL Server. You should use Commang SQL to Crystal Report, with Command: Public Function LayDuLieuDT(ByVal strSQL As String, ByVal table_name As String) As DataTable Try Dim oAdater As SqlClient.SqlDataAdapter Dim oTable As New DataTable Dim ds As New DataSet oAdater = New SqlClient.SqlDataAdapter(strSQL, strConn) oAdater.Fill(ds, table_name) oTable = ds.Tables(table_name) Return oTable Catch End Try End Function
Hi, Thanks for trying to answer my questions, but I am not sure what you are saying here. First, I DO use a stored procedure, and I want the dataet to be used at run time. This is my problem. Second, you provide a function that returns a datatable. That is not needed for what my questions / issues are. I have the problem where I specify OLEDB connection and a query at design time to specify my available fields. I drag these fields onto my report and save. Then at run time, I use the Crystal Reports Engine to specify the dataset (from my stored procedure results). But, the data always appears to be the result of the query specified at design time. I Searched the web, and saw instructions to uncheck "Save Report With Data". on the File menu. This does not exist. I suspect this suggestion only applies to the full product, and not the Visual Studeio .NET version. I had other issues too (Like how to dynamically make fields disappear based on app security priveledges, and whether a report can be built from scratc at run time, and whether Windows Authentication can be used / specified at RUN time) but this was my main problem. Thanks, -Len Thanks, -Len Miller "If I had eight hours to chop down a tree, I'd spend six sharpening my axe." -Abraham Lincoln