难以在Crystal报表中显示数据 [英] Getting proble to display data in crystal report
本文介绍了难以在Crystal报表中显示数据的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想在水晶报表中显示记录.
I want to display the record in crystal report.
CrystalReport2 obj = new CrystalReport2();
SqlConnection con = new SqlConnection();
//This is connection class that return string.
ConnectionClass cc = new ConnectionClass();
con.ConnectionString = cc.GetConnection();
con.Open();
//ds = new DataSet();
DataSet2 ds = new DataSet2();
SqlDataAdapter da = new SqlDataAdapter("Select * from Sample", con);
SqlCommandBuilder builder = new SqlCommandBuilder(da);
da.Fill(ds, "Sample");
obj.SetDataSource(ds);
crystalReportViewer1.ReportSource = obj;
该代码不起作用..
请帮我......
在此先感谢!
This code is not working..
Plz help me......
Thanks in advance!
推荐答案
Hai Friend,use this statement to set the datasource
obj.SetDataSource(ds.Tables[0]);
这篇关于难以在Crystal报表中显示数据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文