In Table record as follows
Schdate course Staff Active
28 Aug 14 MFA BJR A
29 Aug 14 EFA RPK A
When i click the From date i want to check for selected date record is there in the database.
To check the existence of the record use the query:
SqlCommand cmd;
SqldataAdapter adpt = new SqlDatAdapter("select count(*) from tablename where Schdate='28-Aug-14'",cn);
DataSet ds = new DataSet();
adpt.Fill(ds);
if (ds.Tables[0].Rows.Count > 0)
{
Response.Write("Record Exists");
for (int i=0;i<ds.tables[0].rows.count;i++)>
{
cmd = new SqlCommand("update tablename set Active='D' where Staff = '" + ds.Tables[0].Rows[i][2].ToString() + "'",cn);
cn.Open();
cmd.ExeceuteNonQuery();
cn.Close();
cmd.Dispose();
}
}
else
{
Response.Write("Record Not Exists");
}