473,837 Members | 1,931 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Crystal Report and Requests

I don't see my question with my newsreader, just try to post a last time,
sorry if it's (one more...) bug of OE...

Hi,

I have created a crytal report based on a table of my SQL Server. Everything
works fine.
I would like now to fill my report with a sql request in the code behind
instead of the table in the crystal report.
But in the following code, the dataset created isn't "used" by the crystal
report wich continues to use the table.
And if i delete the table in the crystal report to use unbound fields, it
doesn't work.

Any idea?

myCR = new CrystalReport1( );
myCR.SetDatabas eLogon("sa", "mypassword ");
SqlConnection cn=new SqlConnection(a ccessbdd.chaine SQL);
SqlCommand cmd=new SqlCommand();
cmd.Connection= cn;
cmd.CommandText ="SELECT TOP 10 * FROM Table1";
cmd.CommandType =CommandType.Te xt;
SqlDataAdapter da=new SqlDataAdapter( cmd);
DataSet ds=new DataSet();
da.Fill(ds);
myCR.SetDataSou rce(ds);
CrystalReportVi ewer1.ReportSou rce=myCR;

Thanks.

Nov 19 '05 #1
3 1666
Hi,

If you want to use a DataSet as datasource for a crystal report, you need to
create a typed dataset and use this typed dataset when designing the report.

Then, from your code behind, you can create an instance of the typed dataset
and fill with the data. Then call this method.

myCR.SetDataSou rce(ds);

There is no need for calling SetDatabaseLogo n("sa", "mypassword ");
--
Saravanan K V
"Téo" wrote:
I don't see my question with my newsreader, just try to post a last time,
sorry if it's (one more...) bug of OE...

Hi,

I have created a crytal report based on a table of my SQL Server. Everything
works fine.
I would like now to fill my report with a sql request in the code behind
instead of the table in the crystal report.
But in the following code, the dataset created isn't "used" by the crystal
report wich continues to use the table.
And if i delete the table in the crystal report to use unbound fields, it
doesn't work.

Any idea?

myCR = new CrystalReport1( );
myCR.SetDatabas eLogon("sa", "mypassword ");
SqlConnection cn=new SqlConnection(a ccessbdd.chaine SQL);
SqlCommand cmd=new SqlCommand();
cmd.Connection= cn;
cmd.CommandText ="SELECT TOP 10 * FROM Table1";
cmd.CommandType =CommandType.Te xt;
SqlDataAdapter da=new SqlDataAdapter( cmd);
DataSet ds=new DataSet();
da.Fill(ds);
myCR.SetDataSou rce(ds);
CrystalReportVi ewer1.ReportSou rce=myCR;

Thanks.

Nov 19 '05 #2
In my experience, it’s better to use datatable rather than dataset as CR’s
data source.

HTH

Elton Wang
el********@hotm ail.com
"Téo" wrote:
I don't see my question with my newsreader, just try to post a last time,
sorry if it's (one more...) bug of OE...

Hi,

I have created a crytal report based on a table of my SQL Server. Everything
works fine.
I would like now to fill my report with a sql request in the code behind
instead of the table in the crystal report.
But in the following code, the dataset created isn't "used" by the crystal
report wich continues to use the table.
And if i delete the table in the crystal report to use unbound fields, it
doesn't work.

Any idea?

myCR = new CrystalReport1( );
myCR.SetDatabas eLogon("sa", "mypassword ");
SqlConnection cn=new SqlConnection(a ccessbdd.chaine SQL);
SqlCommand cmd=new SqlCommand();
cmd.Connection= cn;
cmd.CommandText ="SELECT TOP 10 * FROM Table1";
cmd.CommandType =CommandType.Te xt;
SqlDataAdapter da=new SqlDataAdapter( cmd);
DataSet ds=new DataSet();
da.Fill(ds);
myCR.SetDataSou rce(ds);
CrystalReportVi ewer1.ReportSou rce=myCR;

Thanks.

Nov 19 '05 #3
Thanks, do you have a tutorial link or an example ?
In fact, the request on wich the CR is based, is changing ("WHERE num_id>" +
TB1.Text, for example), so i don't want to create the source of the CR at
"design time".
I have to do it dynamically in the code behind...

Thanks.
Nov 19 '05 #4

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

Similar topics

1
19192
by: Stephan | last post by:
Hi, I'm using Visual Studio 2003 (C#) with the integrated Crystal Report software and have the following question: How can I assign a value (string) to an unbound (string) field in Crystal Report at runtime? Example: private void button1_Click(object sender,
13
15185
by: kristoff plasun | last post by:
I have a problem with a C++ DCOM application that prints Crystal Reports with data from Oracle. The SQL query is relatively complex but when the report is printed from the Crystal Reports designer it shows up very fast. When the report is printed from my application it takes about ten times as long to get the report to appear. When printing straight from the Crystal Reports
0
3641
by: Danny J. Lesandrini | last post by:
First, this is _not_ a question about how to get Crystal Reports to run on a client machine. I've got all the merge modules added to the project and it's working fine. The question is about distributing my .RPT files. 1) Initial Setup Project inclusion of .rpt files: My folder of new .RPT files keeps growing. Is there a way to point my deployment/setup project to the folder containing these .RPT files so they are added...
1
3087
by: bthomas71chevy | last post by:
I have just setup a WebServer and all the applications work fine, but when every any of the applications try to generate a Crystal Report the page errors out. "File or assembly name CrystalKeyCodeLib, or one of its dependencies, was not found." I read that the 4 MSM files need to be moved to the a MERGE MODULES folder in the Common Files folder, but didn't seem to do a thing.
0
2634
by: Danny J. Lesandrini | last post by:
Didn't get any takers on this post this morning at dotnet.General, so I'm reposting here. First, this is _not_ a question about how to get Crystal Reports to run on a client machine. I've got all the merge modules added to the project and it's working fine. The question is about distributing my .RPT files. 1) Initial Setup Project inclusion of .rpt files: My folder of new .RPT files keeps growing. Is there a way to point
3
8454
by: ian_jacobsen | last post by:
First let me start by saying that this problem is not consistently reproducible. I have a windows service that creates reports for a group of entities. This service can process multiple groups at a single time, where each group is running in a separate thread. I have noticed mixed behavior when running multiple groups at one time (in separate threads). I have received the following two messages logged as errors. - A Crystal Reports...
0
1473
by: Aaron | last post by:
Hi, I am using crystal reports for VS 2003. I wanted to have a field on the report that would display which copy of report it was. So if the user requests 3 copies of report (for example, using the print dialog in the report viewer), the first copy will show a 1, the second copy a 2, and the third copy a 3. I can really only think of one way to do this and that would be print the report 3 times (3 seperate print jobs) and each time...
3
1825
by: GaryDean | last post by:
This is really a licence question.... I want to deploy the version of Crystal Reports that comes with Visual Studio 2005 to a production server. Is there another license charge if the I'm licensed on the production server to run Visual Studio? -- Regards, Gary Blakely
11
9702
by: =?Utf-8?B?cmtibmFpcg==?= | last post by:
How can I stop receiving this message while calling a crystal report? "The report you requested requires further information." Thanks
0
9843
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9682
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10877
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10273
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9402
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5670
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5849
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4474
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
3124
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.