使用水晶报告部署c#项目 [英] deploy c# project with crystal report

查看:54
本文介绍了使用水晶报告部署c#项目的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

HI
我使用水晶报告部署我的c#2010项目,并且每件事情都没有问题但是当我运行任何报告时它显示空白报告

任何帮助请

HI I deploy my c#2010 project with crystal report and every thing work without problems but when i run any report it shows blank report
any help please

推荐答案

非常感谢所有人....

我解决它

private void button1_Click(object sender,EventArgs e)< br $>
{

passParmeters();

getstoreid(comboBox1.Text);



尝试

{

conn.Open();

string query =select * from org_table;

string subquery =select item_no,itemsnames,sum(cuantity)from item_store from store_id ='+ store_ID +'GROUP BY item_no;

da = new MySqlDataAdapter(query,conn);

sub = new MySqlDataAdapter(subquery,conn);

dt = new DataTable() ;

dt.Clear();

da.Fill(dt);

dt1 = new DataTable();

dt1.Clear();

sub.Fill(dt1);

string strPath = System.Windows.Forms.Application.StartupPath.Substring

(0,System.Windows.Forms.Application.StartupPath.Substring

(0,System.Windows.Forms.Application.StartupPath.LastIndexOf(\\))。 LastIndexOf(\\));

strPath + = @\ Addports \ItemsInStoresRP.rpt;



if(dt.Rows.Count> 0)

{

ReportDocument RptDoc = new ReportDocument( );

RptDoc.Load(strPath);

RptDoc.VerifyDatabase();

RptDoc.SetDataSource(dt);

////获取子报告并将datatable1分配给该报告

foreach(RptDoc.ReportDefinition.ReportObjects中的ReportObject repOp)

{

if(repOp.Kind == ReportObjectKind.SubreportObject)

{

string SubRepName =((SubreportObject)repOp).SubreportName;

ReportDocument subRepDoc = RptDoc.Subreports [SubRepName];

subRepDoc.VerifyDatabase();

subRepDoc.SetDa taSource(dt1);

}

}



crystalReportViewer1.ReportSource = RptDoc;

crystalReportViewer1.DataBindings.ToString();

crystalReportViewer1.Refresh();





}



}

catch(例外情况)

{

//回复.WRITE(ex.ToString());

}



终于

{

conn.Close(); < br $>
}

button1.Enabled = false;



}
Many thanks for all ....
I solve it
private void button1_Click(object sender, EventArgs e)
{
passParmeters();
getstoreid(comboBox1.Text);

try
{
conn.Open();
string query = "select * from org_table";
string subquery = "select item_no ,itemsnames ,sum(cuantity) as cuantity from item_store where store_id='" + store_ID + "'GROUP BY item_no";
da = new MySqlDataAdapter(query, conn);
sub = new MySqlDataAdapter(subquery, conn);
dt = new DataTable();
dt.Clear();
da.Fill(dt);
dt1 = new DataTable();
dt1.Clear();
sub.Fill(dt1);
string strPath = System.Windows.Forms.Application.StartupPath.Substring
(0, System.Windows.Forms.Application.StartupPath.Substring
(0, System.Windows.Forms.Application.StartupPath.LastIndexOf("\\")).LastIndexOf("\\"));
strPath += @"\Reports\ItemsInStoresRP.rpt";

if (dt.Rows.Count > 0)
{
ReportDocument RptDoc = new ReportDocument();
RptDoc.Load(strPath);
RptDoc.VerifyDatabase();
RptDoc.SetDataSource(dt);
////Get sub report and assign datatable1 to that report
foreach (ReportObject repOp in RptDoc.ReportDefinition.ReportObjects)
{
if (repOp.Kind == ReportObjectKind.SubreportObject)
{
string SubRepName = ((SubreportObject)repOp).SubreportName;
ReportDocument subRepDoc = RptDoc.Subreports[SubRepName];
subRepDoc.VerifyDatabase();
subRepDoc.SetDataSource(dt1);
}
}

crystalReportViewer1.ReportSource = RptDoc;
crystalReportViewer1.DataBindings.ToString();
crystalReportViewer1.Refresh();


}

}
catch (Exception ex)
{
//Response.Write(ex.ToString());
}

finally
{
conn.Close();
}
button1.Enabled = false;

}


这篇关于使用水晶报告部署c#项目的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆