TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Sai Ram
NA
237
115.7k
CrystalReports
Sep 20 2011 10:31 AM
In Crystal Reports, if i create, Report from VS 2008 Report Template using SQL Command.(All Data will display when we preview Crystal Report in Designing)...While Calling from Windows Form is it required to use Dataset again to Report Document to display Crystal Report....
I am giving my Code below:-
private void btnGenerate_Click(object sender, EventArgs e)
{
try
{
string repquery = "SELECT Building_No,Building_Name FROM Buildings order by Building_No ";
SqlDataAdapter da1 = new SqlDataAdapter(repquery, con);
DataSet ds = new DataSet();
da1.Fill(ds, "Buildings");
DataTable dt = new DataTable();
dt = ds.Tables["Buildings"];
if (dt.Rows.Count != 0)
{
label7.Text = "Report is loading...";
ReportDocument rpt = new ReportDocument();
rpt.Load("\\Reports\\Buildings.rpt.rpt");
string comp = rpt.GetComponentName();
rpt.SetDataSource(dt);
SummaryInfo sinfo = rpt.SummaryInfo;
sinfo.ReportTitle = "Buildings ";
Form frm1 = new Form();
label7.Text = "";
frm1.SetDesktopBounds(0, 0, 1024, 768);
CrystalDecisions.Windows.Forms.CrystalReportViewer crystalReportViewer1 = new CrystalDecisions.Windows.Forms.CrystalReportViewer();
crystalReportViewer1.ReportSource = rpt;
crystalReportViewer1.Dock = DockStyle.Fill;
crystalReportViewer1.Refresh();
frm1.Controls.Add(crystalReportViewer1);
frm1.MaximumSize = new System.Drawing.Size(1600, 1000);
frm1.TopMost = true;
frm1.Show();
//frm1.WindowState=
frm1.Text = "Buildings.";
}
else
MessageBox.Show("Records Are Empty!", "Alarm Reports Message");
}
catch (FormatException ex)
{
//MessageBox.Show(ex.Message, "Alarm Reports Message");
}
}
Reply
Answers (
1
)
Re:Scroll bar and multiple select item in ListBox in Silverlight.
Difference between Thread pool and asynchronous tcp server