473,322 Members | 1,352 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,322 software developers and data experts.

C#, Crystal Report and Stored Procedure

Hi,
I am clueless on how to integrate stored procedure in Crystal Reports using
C#. Any pointers please?

Thanks
Lalit
Nov 15 '05 #1
10 9941
Not sure about the Stored Proc, but you can use the proc to populate a
DataSet then use dataset.WriteXML("SomeFile.xml"). Do this once just to
generate the file. Then, you can use that first file to use the CR Report
designer. Afterward, just recreate the XML file and then call the report.
"Lalit Parashar" <la****@mapleusa.com.NOSPAM> wrote in message
news:%2****************@TK2MSFTNGP12.phx.gbl...
Hi,
I am clueless on how to integrate stored procedure in Crystal Reports using C#. Any pointers please?

Thanks
Lalit

Nov 15 '05 #2
Just retrieve the DataSet using the stored proc and then pass that DataSet
to your document's DataSource property. Something like this:

....
ds = _currencyProcessor.GetCashLedgerReportData(Currenc ySortOrder.BySlot,

dtpCurRptOptFromDate.Value,

cbCurRptOptSessionOnly.Checked).DataSet;

oRD = new Currency_CashLedger();

oRD.SetParameterValue("SessionOnly", cbCurRptOptSessionOnly.Checked);

oRD.SetParameterValue("RoomNumber", _currConfig.LocationID.ToString());

oRD.SetParameterValue("Name", _Name);

oRD.SetParameterValue("TransactionDate", dtpCurRptOptFromDate.Value);

oRD.SetDataSource(ds.Tables[0]);

crystalReportViewer2.ReportSource = oRD;

....

Scott

I am clueless on how to integrate stored procedure in Crystal Reports using C#. Any pointers please?

Nov 15 '05 #3
Hi Lalit

Take a look at http://www.crystalreportsbook.com/ there you will find ALL
the info you need, especially the chapter 14

Hope this help,

--
Ignacio Machin,
ignacio.machin AT dot.state.fl.us
Florida Department Of Transportation

"Lalit Parashar" <la****@mapleusa.com.NOSPAM> wrote in message
news:%2****************@TK2MSFTNGP12.phx.gbl...
Hi,
I am clueless on how to integrate stored procedure in Crystal Reports using C#. Any pointers please?

Thanks
Lalit

Nov 15 '05 #4
Hi William,

Hvae you tested this approach on a web escenario? I havent been able to use
this push model from the web.

Cheers,

--
Ignacio Machin,
ignacio.machin AT dot.state.fl.us
Florida Department Of Transportation

"William Ryan" <do********@comcast.nospam.net> wrote in message
news:OQ**************@TK2MSFTNGP12.phx.gbl...
Not sure about the Stored Proc, but you can use the proc to populate a
DataSet then use dataset.WriteXML("SomeFile.xml"). Do this once just to
generate the file. Then, you can use that first file to use the CR Report
designer. Afterward, just recreate the XML file and then call the report.
"Lalit Parashar" <la****@mapleusa.com.NOSPAM> wrote in message
news:%2****************@TK2MSFTNGP12.phx.gbl...
Hi,
I am clueless on how to integrate stored procedure in Crystal Reports

using
C#. Any pointers please?

Thanks
Lalit


Nov 15 '05 #5
No, I sure haven't. I was thinking it should work on the web as long as you
can write over the old XML file, but that could present some security
issues. Let me play around with it and see what happens b/c that's a very
good question.

Cheers,

Bill
"Ignacio Machin" <ignacio.machin AT dot.state.fl.us> wrote in message
news:eH**************@TK2MSFTNGP11.phx.gbl...
Hi William,

Hvae you tested this approach on a web escenario? I havent been able to use this push model from the web.

Cheers,

--
Ignacio Machin,
ignacio.machin AT dot.state.fl.us
Florida Department Of Transportation

"William Ryan" <do********@comcast.nospam.net> wrote in message
news:OQ**************@TK2MSFTNGP12.phx.gbl...
Not sure about the Stored Proc, but you can use the proc to populate a
DataSet then use dataset.WriteXML("SomeFile.xml"). Do this once just to
generate the file. Then, you can use that first file to use the CR Report designer. Afterward, just recreate the XML file and then call the report. "Lalit Parashar" <la****@mapleusa.com.NOSPAM> wrote in message
news:%2****************@TK2MSFTNGP12.phx.gbl...
Hi,
I am clueless on how to integrate stored procedure in Crystal Reports

using
C#. Any pointers please?

Thanks
Lalit



Nov 15 '05 #6
Hi,

Cause I haven't been able to do so, I always get the "Logon failed" error
:(

cheers,

--
Ignacio Machin,
ignacio.machin AT dot.state.fl.us
Florida Department Of Transportation
"William Ryan" <do********@comcast.nospam.net> wrote in message
news:uv**************@tk2msftngp13.phx.gbl...
No, I sure haven't. I was thinking it should work on the web as long as you can write over the old XML file, but that could present some security
issues. Let me play around with it and see what happens b/c that's a very
good question.

Cheers,

Bill
"Ignacio Machin" <ignacio.machin AT dot.state.fl.us> wrote in message
news:eH**************@TK2MSFTNGP11.phx.gbl...
Hi William,

Hvae you tested this approach on a web escenario? I havent been able to

use
this push model from the web.

Cheers,

--
Ignacio Machin,
ignacio.machin AT dot.state.fl.us
Florida Department Of Transportation

"William Ryan" <do********@comcast.nospam.net> wrote in message
news:OQ**************@TK2MSFTNGP12.phx.gbl...
Not sure about the Stored Proc, but you can use the proc to populate a
DataSet then use dataset.WriteXML("SomeFile.xml"). Do this once just to generate the file. Then, you can use that first file to use the CR Report designer. Afterward, just recreate the XML file and then call the report. "Lalit Parashar" <la****@mapleusa.com.NOSPAM> wrote in message
news:%2****************@TK2MSFTNGP12.phx.gbl...
> Hi,
> I am clueless on how to integrate stored procedure in Crystal Reports using
> C#. Any pointers please?
>
> Thanks
> Lalit
>
>



Nov 15 '05 #7
Why not design the report directly against the stored proc and then pass the
dataset directly to the report document at runtime? IOW, why not "push" the
data the report? I'm probably missing something obvious, but we have
several reports working this way with traditional and web apps.

Scott
Not sure about the Stored Proc, but you can use the proc to populate a
DataSet then use dataset.WriteXML("SomeFile.xml"). Do this once just to
generate the file. Then, you can use that first file to use the CR Report
designer. Afterward, just recreate the XML file and then call the report.

Nov 15 '05 #8
Thats helpful.

Thanks
Lalit

"Ignacio Machin" <ignacio.machin AT dot.state.fl.us> wrote in message
news:OI*************@TK2MSFTNGP11.phx.gbl...
Hi Lalit

Take a look at http://www.crystalreportsbook.com/ there you will find ALL
the info you need, especially the chapter 14

Hope this help,

--
Ignacio Machin,
ignacio.machin AT dot.state.fl.us
Florida Department Of Transportation

"Lalit Parashar" <la****@mapleusa.com.NOSPAM> wrote in message
news:%2****************@TK2MSFTNGP12.phx.gbl...
Hi,
I am clueless on how to integrate stored procedure in Crystal Reports

using
C#. Any pointers please?

Thanks
Lalit


Nov 15 '05 #9
This is what I did, but it gives me "Invalid report file path"
exception.Message.

myReport = new ReportDocument();

ds = MakeDataSet();

ds.WriteXml(@"C:\FileName.xml");

myReport.SetDataSource(ds);

cfsReportViewer.ReportSource = myReport;

Thanks,

Lalit

"Scott Carter" <scott[the letter c] [ @ ] turbopower[DOTnet]> wrote in
message news:eK**************@TK2MSFTNGP11.phx.gbl...
Just retrieve the DataSet using the stored proc and then pass that DataSet
to your document's DataSource property. Something like this:

...
ds = _currencyProcessor.GetCashLedgerReportData(Currenc ySortOrder.BySlot,

dtpCurRptOptFromDate.Value,

cbCurRptOptSessionOnly.Checked).DataSet;

oRD = new Currency_CashLedger();

oRD.SetParameterValue("SessionOnly", cbCurRptOptSessionOnly.Checked);

oRD.SetParameterValue("RoomNumber", _currConfig.LocationID.ToString());

oRD.SetParameterValue("Name", _Name);

oRD.SetParameterValue("TransactionDate", dtpCurRptOptFromDate.Value);

oRD.SetDataSource(ds.Tables[0]);

crystalReportViewer2.ReportSource = oRD;

...

Scott

I am clueless on how to integrate stored procedure in Crystal Reports

using
C#. Any pointers please?


Nov 15 '05 #10
> myReport = new ReportDocument();

If this isn't a typed report, you need to Load your report into your
document:

myReport.Load(@"YourReportFile.rpt");
ds = MakeDataSet(); ds.WriteXml(@"C:\FileName.xml");
There's no need to write your dataset to disk.
myReport.SetDataSource(ds);

cfsReportViewer.ReportSource = myReport;


Everything else looks good -- good luck.

Scott
Nov 15 '05 #11

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Scott | last post by:
Hello: I have a stored procedure for generating our invoices in Crystal Reports. I have added a new field to the SP, but when I try to add the field to my Crystal Report invoice, the field isn't...
1
by: Joe | last post by:
Hi friends, I need dynamically generate the crystal line graph from the c# application. i used stored procedure.but i don't know how to connect the C#, stored procedure and crystal report. 1....
0
by: Craig Faulkner | last post by:
I have been fighting through my first crystal report in VS2003.NET and have made some headway. Here is what I've done: 1. Created a crystal report in VS2003 from a SQL stored procedure with...
0
by: mmccor | last post by:
Hi. I'm having a problem passing a value to a sql stored procedure parameter in a crystal report. When I run a trace on Sql Server the parameters are empty or null. The procedure contains one...
3
by: Diggler | last post by:
I was working on a report that is populated with three different tables in a strongly-typed dataset. The tables are populated from custom objects rather than directly from SQL Server. I loop...
12
by: Bill Nguyen | last post by:
What's the VB syntax to run the CR report using the following SP? I use CrystalreportViewer and ReportDocument. Thanks Bill Here's the SP in SQLserver 2K: CREATE proc mysp_ReportSubmission...
0
by: arock | last post by:
I've created a SQL Server stored procedure that uses a temporary table (#tempTable) to run some sub-queries within the main SELECT statement. This works perfectly fine within the Crystal Designer...
4
by: yin_n_yang74 | last post by:
I am new to SQL and SQL Server world. There must be a simple solution to this, but I'm not seeing it. I am trying to create a crystal report (v8.5) using a stored procedure from SQL Server...
0
by: Justin K | last post by:
I have an issue with a Crystal Report that I am using in my C# program. I created the report in Crystal Reports XI(R2). The report's datasource is an SQL stored procedure, and contains a...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.