Namespaces to use.
using System.Data.SqlClient;
using CrystalDecisions.CrystalReports.Engine;
Code....
SqlConnection con=new SqlConnection(@"Data Source=.\sqlexpress;Initial Catalog=NationalBank;Integrated Security=True");
SqlDataAdapter da=new SqlDataAdapter("select * from EmployeeDetails where EMpname like 'g%'",con);
DataSet ds = new DataSet();
da.Fill(ds, "d");
ReportDocument rpt = new ReportDocument();
rpt.Load(Server.MapPath(@"~\CrystalReport.rpt"));
rpt.SetDataSource(ds.Tables["d"]);
CrystalReportViewer1.ReportSource = rpt;
No comments:
Post a Comment