// Declare conn string
String connstr =
"Data Source = 168.10.11.3; Initial Catalog = RealWorld; Persist Security Info = True; User ID = sa; Password = 111111 ";
// Declare conn, command
SqlConnection conn = new SqlConnection (connstr );
SqlCommand cmd = new SqlCommand ();
DataSet ds = new dsReport ();
Try
{
Conn. Open ();
Cmd. Connection = conn;
Cmd. CommandText = "SELECT * FROM AgedAR ";
SqlDataReader dr = cmd. ExecuteReader ();
Ds. Tables [0]. Load (dr );
// ================================================ ========
// Different from winform
// Reportviewer1.localreport. reportembeddedresource = "report1.rdlc ";
Reportviewer1.localreport. reportpath = "report1.rdlc ";
// Report datasource
Reportdatasource RDS = new reportdatasource ();
RDS. Name = "dsreport_dtagedar ";
RDS. value = Ds. Tables [0];
ReportViewer1.LocalReport. CES. Add (rds );
}
Catch (Exception ex)
{
Response. Write (ex. Message );
}
Finally
{
Conn. Close ();
}