.NETGURU
Dataset with joins
Messages   Related Types
This message was discovered on ASPFriends.com 'ngfx-crystal' list.


Revanna S R
Hi,

I have a problem when using crystal reports with vs.net. I have managed to =
write progam which display data on the report when using a single table =
for query, I use datasets to push data to the report. But once I start =
using joins in the dataset the report does not display data. The dataset =
is correctly populated with data. I have attached the code below

public void BindData()
{
string spState;
spState =3D "wa";
oRpt =3D new crMyFourth();
OleDbConnection oleConn =3D new OleDbConnection("Provider=3DSQLOLEDB.1=
;user id=3Dsa;password=3Dxxx;initial catalog=3Dpubs;data source=3Dbpaul;Con=
nect Timeout=3D30");
OleDbDataAdapter oleAdapter =3D new OleDbDataAdapter("select * from =
stores inner join sales on stores.stor_id =3D sales.stor_id where state =
=3D '"+ spState +"'", oleConn);
dsMyFourth dataset =3D new dsMyFourth();
dataset.EnforceConstraints =3D false;
oleAdapter.Fill(dataset, "Stores");
int x =3D dataset.Tables[0].Rows.Count;
//here I correctly get 6 rows in the dataset, but the report does not =
display this.
oRpt.SetDataSource(dataset);
CrystalReportViewer1.ReportSource =3D oRpt;
}

I call binddata from pageload().=20

I have only two field in the report from the store table, store_name and =
store _address.

I am really struggling with this pls help.

Also let me know if I can get some free good tutorial for crystal reports =
for .net

Many Thanks,
Rev=20

__________________________________________________
*** Confidentiality Notice ***

Proprietary/Confidential Information belonging
to CGI may be contained in this message.
If you are not a recipient indicated or intended
in this message (or responsible for delivery
of this message to such person), or you think
for any reason that this message may have been
addressed to you in error, you may not use or
copy or deliver this message to anyone else.
In such case, you should destroy this message
and kindly notify the sender by reply email.

Reply to this message...
 
    
Tim
Dit you try to run the query in SQL Query Analyzer or something to see =
it actually does return a result. Otherwise its logical the report is =
blank...

----- Original Message -----
From: "Revanna S R" <Click here to reveal e-mail address>
To: Click here to reveal e-mail address
Sent: Mon, 12 Aug 2002 23:10:53 +0530
Subject: Dataset with joins
[Original message clipped]

table for query, I use datasets to push data to the report. But once I =
start using joins in the dataset the report does not display data. The =
dataset is correctly populated with data. I have attached the code below
[Original message clipped]

id=3Dsa;password=3Dxxx;initial catalog=3Dpubs;data =
source=3Dbpaul;Connect Timeout=3D30");
> OleDbDataAdapter oleAdapter =3D new OleDbDataAdapter("select * =
from stores inner join sales on stores.stor_id =3D sales.stor_id where =
state =3D '"+ spState +"'", oleConn);
[Original message clipped]

Reply to this message...
 
    
Elena Igartua
(Type your message here)
I have the same problem. Dataset has 1 rows but crystalreport display 4 rows.
Why?

Thanks.
--------------------------------
From: Elena Igartua
Reply to this message...
 
    
Elena Igartua
(Type your message here)
I have the same problem. Dataset has 1 rows but crystalreport display 4 rows.
Why?

Thanks.
--------------------------------
From: Elena Igartua
Reply to this message...
 
    
Elena Igartua
I have the same problem. Dataset has 2 rows but after:
orpt.setdatasource(Dataset)
and the report display 8 rows.

Why?
Thanks.

--------------------------------
From: Elena Igartua
Reply to this message...
 
    
Faiza Izhar
(Type your message here)

--------------------------------
From: Faiza Izhar
I'm using Access as database and I've to generate report for my project. I just don't know how to pass parameter to dataset and use it with report. So, kindly help me out for querying dataset to retrieve result.
thanx anyways
Reply to this message...
 
    
jan yaqoob
You need to use OleDBDataAdapter for Access.

I am sending code for VB.NET:

Add OleDBDataAdapter, CrystalReportViewer in your Form
In DataAdapter (MyDA) use this command and specify the TableName
"SELECT * FROM TableName"
Generate DataSet (MyDS)for the DataAdapter and add the Table (TableName)
Add a Create Report (MyReport), Choose Report Expert and add DateSet Fields to the Report.
Add a CrystalReportViewer (CrystalReportViewer1) into your Form
Add a Button and in the Button Click event add this code

dim rpt as new MyReport

Try
myDA.Fill(myDSB, "TableName")
rpt.SetDataSource(MyDS)
CrystalReportViewer1.ReportSource = rpt
CrystalReportViewer1.RefreshReport()
Catch Ex As Exception
MessageBox.Show("Report causing Problems")
MessageBox.Show(Excep.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error)

End Try

Take Care

Jan
Reply to this message...
 
 
System.Data.Common.DataAdapter
System.Data.DataSet
System.Data.OleDb.OleDbConnection
System.Data.OleDb.OleDbDataAdapter
System.Windows.Forms.MessageBox
System.Windows.Forms.MessageBoxButtons
System.Windows.Forms.MessageBoxIcon




ExamGuru IT Solutions - .Net Guru is owned and operated by ExamGuru, Inc., the man behind .Net Guru. If you're in the market for bespoke software or software consultancy, why not get him and his highly trained team to help? - www.examguru.net/ITCertification
Ad


Need Dot Net Interview Questions?
Ask ExamGuru, Inc. for advice and help on Passing .Net Interviews
.Net Projects
Best-of-breed application framework for .NET projects, developed by ExamGuru, Inc. and ExamGuru IT
Free .net Help
Commission ExamGuru, Inc. and his team for your next bespoke software project
FogBUGZ
The only bug tracking system carefully crafted with one goal in mind: helping teams create great software.
Awesome Tools
If you don't know about these, you're missing out... IT Certification Questions
IT Interview Questions
Free Oracle 10g Training
MCSE Boortcamp
Cisco Study Guides
Cheap Study Guides
Exact Questions
Dot Net Interview Questions
Oracle OCP
Cheap Travel
Designer Perfumes - Wholesale Prices
Free Programming Tutorials
 
ExamGuru IT Solutions - .Net Guru is owned and operated by ExamGuru, Inc., the man behind .Net Guru. If you're in the market for bespoke software or software consultancy, why not get him and his highly trained team to help? - www.examguru.net/ITCertification
 Copyright © ExamGuru, Inc. 2001-2006
Contact Us - Terms of Use - Privacy Policy - www.dot-net-guru.com - www.examguru.net - www.oraclesource.net - www.itinterviews.net - www.examguru.net/ITCertification