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.SetDatabaseLogon("sa", "mypassword");
SqlConnection cn=new SqlConnection(accessbdd.chaineSQL);
SqlCommand cmd=new SqlCommand();
cmd.Connection=cn;
cmd.CommandText="SELECT TOP 10 * FROM Table1";
cmd.CommandType=CommandType.Text;
SqlDataAdapter da=new SqlDataAdapter(cmd);
DataSet ds=new DataSet();
da.Fill(ds);
myCR.SetDataSource(ds);
CrystalReportViewer1.ReportSource=myCR;
Thanks. 3 1616
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.SetDataSource(ds);
There is no need for calling SetDatabaseLogon("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.SetDatabaseLogon("sa", "mypassword"); SqlConnection cn=new SqlConnection(accessbdd.chaineSQL); SqlCommand cmd=new SqlCommand(); cmd.Connection=cn; cmd.CommandText="SELECT TOP 10 * FROM Table1"; cmd.CommandType=CommandType.Text; SqlDataAdapter da=new SqlDataAdapter(cmd); DataSet ds=new DataSet(); da.Fill(ds); myCR.SetDataSource(ds); CrystalReportViewer1.ReportSource=myCR;
Thanks.
In my experience, it’s better to use datatable rather than dataset as CR’s
data source.
HTH
Elton Wang el********@hotmail.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.SetDatabaseLogon("sa", "mypassword"); SqlConnection cn=new SqlConnection(accessbdd.chaineSQL); SqlCommand cmd=new SqlCommand(); cmd.Connection=cn; cmd.CommandText="SELECT TOP 10 * FROM Table1"; cmd.CommandType=CommandType.Text; SqlDataAdapter da=new SqlDataAdapter(cmd); DataSet ds=new DataSet(); da.Fill(ds); myCR.SetDataSource(ds); CrystalReportViewer1.ReportSource=myCR;
Thanks.
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. This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
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...
|
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...
|
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...
|
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...
|
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...
|
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...
|
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,...
|
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...
|
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
|
by: ryjfgjl |
last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
|
by: BarryA |
last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
by: Sonnysonu |
last post by:
This is the data of csv file
1 2 3
1 2 3
1 2 3
1 2 3
2 3
2 3
3
the lengths should be different i have to store the data by column-wise with in the specific length.
suppose the i have to...
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
|
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...
|
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,...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
|
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...
| |