- you need use the following code for remove old data:
Code: Select all
report.Dictionary.Databases.Clear();
report.Dictionary.DataSources.Clear();
Code: Select all
report.Dictionary.Databases.Clear();
report.Dictionary.DataSources.Clear();
Code: Select all
report.Dictionary.Databases.Clear();
report.Dictionary.DataSources.Clear();
report.RegData("Con", Emp);
report.RegData("Con", EA);
report.Render(true);
StiWebViewer1.Report = report;
Code: Select all
c:\Users\Shree\AppData\Local\Temp\tn4dqryx.0.cs(35,40) : error CS0103: The name 'Emp' does not exist in the current contextc:\Users\Shree\AppData\Local\Temp\tn4dqryx.0.cs(40,40) : error CS0103: The name 'Emp' does not exist in the current contextc:\Users\Shree\AppData\Local\Temp\tn4dqryx.0.cs(45,40) : error CS0103: The name 'EA' does not exist in the current contextc:\Users\Shree\AppData\Local\Temp\tn4dqryx.0.cs(50,40) : error CS0103: The name 'EA' does not exist in the current contextc:\Users\Shree\AppData\Local\Temp\tn4dqryx.0.cs(55,40) : error CS0103: The name 'EA' does not exist in the current context
Code: Select all
string sql = "Select Name,FatherName from Employee Where ID = 24";
DataSet Con = new DataSet();
Con.DataSetName = "Con";
string connectionString = ConfigurationManager.ConnectionStrings["ApplicationServices"].ConnectionString;
using (SqlConnection connection = new SqlConnection(connectionString))
{
SqlDataAdapter adapter = new SqlDataAdapter(sql +";SELECT Attdate,InTime,OutTime FROM Attendance WHERE F_EmpMaster = 24;", connection);
adapter.TableMappings.Add("Table", "Emp");
adapter.TableMappings.Add("Table1", "EA");
adapter.Fill(Con);
}
string appDirectory = HttpContext.Current.Server.MapPath(string.Empty);
// Load report
StiReport report = new StiReport();
report.Load(appDirectory + "\\Report\\AttReport.mrt");
report.Dictionary.Databases.Clear();
report.Dictionary.DataSources.Clear();
report.RegData(Con);
StiWebViewer1.Report = report;
Code: Select all
protected void Page_Load(object sender, EventArgs e)
{
DataSet ds = new DataSet("Con");
string sql = "Select Name,FatherName from Employee Where ID = 24";
DataTable emp = new DataTable();
emp = SqlClientUtility.ExecuteDataTable("ApplicationServices", CommandType.Text, sql, null);
emp.TableName = "Emp";
ds.Tables.Add(emp);
DataTable ea = new DataTable();
ea = SqlClientUtility.ExecuteDataTable("ApplicationServices", CommandType.Text, "SELECT Attdate,InTime,OutTime FROM Attendance WHERE F_EmpMaster = 24", null);
ea.TableName = "EA";
ds.Tables.Add(ea);
string appDirectory = HttpContext.Current.Server.MapPath(string.Empty);
// Load report
StiReport report = new StiReport();
report.Load(appDirectory + "\\Report\\AttReport.mrt");
report.Dictionary.Databases.Clear();
report.Dictionary.DataSources.Clear();
report.RegData(ds);
report.Dictionary.Synchronize();
report.Render();
StiWebViewer1.Report = report;
}