Как добавить в MyTimers.Last().Parameter
значение ячеек
public class MyTimer : System.Timers.Timer
{
public object Parameter { get; set; }
}
class WriteToFile
{
static void Main(string[] args)
{
using (SqlConnection cn = new SqlConnection()){
cn.ConnectionString = @"Data Source=192.168.1.156;Initial Catalog=ihd_aktobe;Persist Security Info=True;User ID=sa;Password=***********";
cn.Open();
using (SqlDataAdapter adapter = new SqlDataAdapter("select s.id, s.name_ru, s.sendType, c1.cod, s.typPeriod, c2.name_ru, s.metaAlg, m.cod, s.dt_send, s.dt_beg, s.dt_send_daytime, s.dt_period_end from FROM Shedule s inner join ClBaseItem c1 on s.sendType=c1.id inner join ClBaseItem c2 on s.typPeriod=c2.idinner join MetaAlg m on s.metaAlg=m.id", cn))
using (DataTable dt = new DataTable())
{
adapter.Fill(dt);
foreach (DataRow row in dt.Rows)
{
MyTimer myTimer = new MyTimer();
myTimer.Interval = Convert.ToInt32(row["dt_send_daytime"]);
myTimer.Parameter = row["cod"];
myTimer.Parameter = row["dt_beg"];
myTimer.Parameter = row["dt_period_end"];
myTimer.Elapsed += OnTimeout;
myTimer.AutoReset = true;
myTimer.Enabled = true;
}
}
}
}