DiigIT | IT Community
No Profile Image
Welcome Guest
New User? Register | Login

Help Needed For .Net Window Application(Crystal Rpt)

By: Admin | 10 Feb 2010 1:10 pm

Hi, Every One

I am getting error "Load Repot Fail" when i created the setup of my  app.

I used following code

string strReportPath1 = strReportPath. Replace
("\\bin\\Debug" , "\\Forms\\Estimate" ) + "\\" + Estimate+ ".rpt";

Rpt.ShowReport( strReportPath1, ref crystalReportViewer 1, ref label1,
Ds);
-----------
public void ShowReport(string RptFileName, ref CrystalReportViewer
ReportViewerControl Name, ref System.Windows. Forms.Label
lblmsg,DataSet Ds)
{
try
{
ReportViewerControl Name.DisplayGrou pTree = false;

if((RptFileName != null && RptFileName != "") &&
(RptFileName. Contains( ".rpt")== true))
{
if (Ds.Tables[0] .Rows.Count > 0)
{
lblmsg.Text = "";

RptDoc.Load( RptFileName) ;
Ds.WriteXml( "Test.xml" );
RptDoc.SetDataSourc e(Ds);
ReportViewerControl Name.ReportSourc e =
RptDoc;
ReportViewerControl Name.Visible = true;
}
else
{
lblmsg.Text = "Data Not Found";
}
}
else
{
lblmsg.Text = "Report File Not Found.";
}
}

If is there any other way to set .rpt file path & work on setup then  pls help me.

Thnx,

Comments

in the following session the dsreports is the dataset of reportviewer
                                     rolestableadapter is the adapter of tablename rolestable
                                     rptusingdataset is the reportviewer control
                                    
so just the define datasource to reportviewer
 
and i give u a good practice knowledge about that
 
create a table for reportpath and you should save the report path in it
 
and call it in every module
 
this is the best programmer commands.
 
 
 
private
void ShowReport()
{
dsReports ds = new dsReports();
RolesTableAdapter adp = new RolesTableAdapter();
dsReports.RolesDataTable table = new dsReports.RolesDataTable();
adp.Fill(table) ;
rptUsingDataset rpt = new rptUsingDataset();
rpt.SetDataSource( (
DataTable)table);
CrystalReportViewer 1.ReportSource = rpt;
}

 thanx.
 
regards.

By: Admin | 10 Feb 2010

Leave a comment

Enter the text in the image
img
Can't read?
Type the characters you see in the picture below.


Close Move