I am brand-spankin' new to Crystal Reports, and I am trying to create a new report based on an existing one. The author of the original report is long gone. I apologize in advance if my terminology is poor.
The data for the report is based on a connection to an ADO.NET XML .xsd file, and that file in turn reflects data returned from a stored procedure. I have verified that the underlying DataTable for the report contains rows. However, whenever I invoke the crystal report object to create the table, it shows no rows. I am pretty certain the report does not believe there are any rows, as I have a special function to count the number of rows. If that function counts no rows, I have a special field that displays "No data." That field is being displayed.
Is there some setting or something I can investigate to figure this out?
Edit: more information requested
I am using this in a C# Winforms application. The stored procedure is a select statement from SQL server 2008.
Ok, there seems to be a bug in Crystal Reports. When I updated the .xsd file for the data map, Crystal Reports would not always update the underlying connection. Sometimes selecting "Verify Connection" would update it, and sometimes not. I'm guessing this is why the report showed no records. I had to remove all files -- the XSD database table map file, the report file, and all their supporting dependent files -- and then remove the connection. Once the connection was gone, I added all the files back in, and added the datatable connection. This got the correct mapping into the report.
Related
Good afternoon, this is my problem.
I had created a datatable in C# with all the columns i needed, all this on runtime, and displayed all on a grid, all that works fine. Now my end user is asking me to put all that data on an report, but because this is not a table on the SQL i can't create a crystal report like i used to, making connections or using the wizard, so is there a way to create a crystal report or any other kind of report on runtime with autogenerated columns? I'm thinking on exporting to Excel too but i want to be sure i have no other option.
Thanks in advance and sorry for my english, is a little rusty.
I have access to some RDL reports. I can use ReportViewer control in my app to display it, but How can I get data displayed in this report and put them into my database table?
Is it possible?
How can I get data displayed in this report and put them into my database table?
Short answer is No.
Reports are a one way data representation in the form of a read-only report from a datasource. It is not a conduit back to a database or a new database due to the read-only aspect.
To get the data, you need to examine the report, determine how it accesses the data source and use that process to access the get data in your program.
I'm using C# with ASP.NET(2.5) and SQL Server 2005.
I have an SSRS 2005 Report (*.rdl) stored in a varbinary field in the database, and I need to generate a report (in PDF or image file) and send it by e-mail, with some parameters. The CRUD part is OK, but I can't generate the report and export to PDF from an XML string (that I get from the varbinary field).
I don't have any code to give to you folks (sorry). I tried lots of tutorials from the web and none of them suited for me. I also searched here in stack overflow and didn't find anything.
Note 1: I know how to do it from a file stored in a hard drive, for example. I don't want to save the file I get from the varbinary field in the hard drive and generate the report from it. I want to generate the report from the XML string stored in a variable.
Note 2: I'm new to C#, and have another silly question: Crystal Report (.rpt) and SSRS (.rdl) are different files (different XML structures), right?
Firstly, in answer to Note 2, Crystal Reports and SSRS are competitors, so yes, the formats are different.
Secondly, you want to use the ReportExecutionService class. If you have any report parameters to set, use SetExecutionParameters() and Render() with Format=PDF.
I am working in visual 2008 with sql server 2005 as the back end. I am trying to create a crystal report with xsd file.This is what i did.
I created an empty xsd file from "Add New Items".i dragged the stored proc from the server explorer from the database which i want to attach to the crystal on to the xsd.
Created an empty crystal report,attached the xsd file on to the report through "Make new connection" and selected the fields which i want to display in the report.
Now when i do the print preview of the report is shows me the junk data and not the actual data that stored procedure returns.? I cant understand this behaviour.
Am i missing something?
Thats Crystal Reports for you. What you are describing is typical behaviour do not be alarmed. I have written a number of reports specifying a .xml or .xsd document as the data type(You need to remember to select ADO.NET from add connections for the following to work). When I go to run the report I simply specify the actual datatable that I get from SqlServer/Oracle/etc by doing the following
report.Database.Tables[0].SetDataSource(dataTable);
Like you in the preview pane I get bogus values even though my xml file may contain actual data along with the schema but when I actually run the Crystal Report I get the expected out put.
I need to create reports in a C# .NET Windows app. I've got an SQL Server 2005 .I want to display two more field to report(not available in data base table. I want to create these field by adding some data from existing field of data base table)
If you look at the .NET API exposed by Crystal Reports, you'll find that you can inject a DataSet into a report - this gives your application full control over the data used by the report, leveraging Crystal Reports as a presentation engine.
I've used this technique to generate reports over data soures not natively supported by Crystal Reports - it also helps to ensure that all the data comes from the sames source (as the API for changing the connection used within a normal Crystal report is somewhat flakey).
So, what I'd do in your situation is to load all the required data into a DataSet, add the extra columns, and then pass the dataset into the report. Only complex bit is that you need to save out the XML schema of the dataset and import it into Crystal Reports so that it is aware of the shape of your data.
You could use a crystal function also for this. Depending on how complex the calculation is from Column A to B. The more complex the easier it becomes just to do what Bevan says and change the dataset.
If you were more specific i might be able to give you some example code.
Use CR formula field.