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.
Related
I have been given the task of taking Crystal Reports developed with the standalone version of SAP Crystal Reports (2013 SP 2 version 14.1.2.1121) and figuring out a way to deploy them without use of Crystal Reports Server. The data connection is already stored in the report so all I have to do is load the rpt file, pass in a parameter, and display the results.
I thought I could accomplish this in an asp.net application. I am using the following code to export straight to pdf so I don't have to deal with Visual Studio's crystal report viewer:
report.Load(Server.MapPath("CrystalReport1.rpt"));
report.SetParameterValue("Quarter End Date", parmDate);
report.ExportToHttpResponse(ExportFormatType.PortableDocFormat, Response, false, "Report1");
This method works fine for all reports expect for two that contain a chart type of 'Date axis line chart'. When I run these reports through my web app the data fields match up exactly with the original report, but the charts are displaying wrong.
I have included two images below. The top is the proper rendering and the bottom is the rendering when running the report through my code.
I also tried to recreate the report from scratch in Visual Studio and, although the chart data was a little better, it was still off:
As I stated earlier, the report was given to me already completed. The question was could I could figure out a way to allow users to run it on demand supplying their own parameter from a browser without having to buy Crystal Report Server or some other tool.
There is another report that has a pie chart and it looks fine. Does anything have an idea of why this might be occurring?
Thank you.
Ultimately we had to downgrade the version these reports were created with to Crystal Reports 11.5. After that the charts rendered correctly.
most of the time we point store procedure or table and then SSRS report designer show us field and we just drag drop those field on to report designer surface. after all we call those report programmatically and pass parameter and report shown on report viewer.
now my company want that customer will customize the report who will see the report. they want to display all the fields in a form and just customer will select each field and place on report designer surface and give some input like filter condition like date range or employee id etc and report will be shown. also at run time if customer want they can add text or move existing field etc.
i do not have any idea how could i do this with SSRS. if this is possible with SSRS then please guide me in such a way as a result i can start the job or if possible give me few relevant url of that kind from where i can get the idea. thanks
SSRS is capable of reading reports generated on-the-fly, but they have to be made just right. SSRS reports are XML documents that specify the data structure and report object structures and how the two are related. Using Visual Studio, you can use certain classes to create the XML document which is then read & filled with data on the server, then exported to the client as a standard webpage.
Here is a link to a tutorial. This should be a good starting point.
Here is a small but working example of generating RDL on-the-fly with some useful links to MSDN documentation: "How to dynamically generate SSRS Report in Code"
Hope it helps!
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.
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 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.