hi,
tnx for your reply...as i said i am pretty new to windows service
...this is my first one
can you plz guide me where the error is ....this is my onstart event
protected override void OnStart(string[] args)
{
// TODO: Add code here to start your service.
SqlConnection stCon = new SqlConnection("Data
Source=.;Initial Catalog=abcd;User ID=sa;Password = abcd");
SqlDataAdapter da = new SqlDataAdapter("select * from
ActionItems", stCon);
DataSet ds = new DataSet();
da.Fill(ds);
foreach (DataRow dr in ds.Tables[0].Rows)
{
DateTime dueDate = (DateTime)dr["Action_Duedate"];
DateTime now = DateTime.Now;
if((dueDate.Day == now.Day) && (dueDate.Month ==
now.Month) && (dueDate.Year == now.Year))
{
sendMail(dr);
}
}
ServiceController[] services =
ServiceController.GetServices();
foreach (ServiceController x in services)
{
if (x.DisplayName == "ScheduleAlert")
{
if (x.Status ==
System.ServiceProcess.ServiceControllerStatus.Runn ing)
{
x.Stop();
}
else
{
x.Start();
}
}
}
}
thank you once again
*** Sent via Developersdex
http://www.developersdex.com ***