c# datagrid

Jun 16 2015 9:35 AM
Hi,
I am a newbie started learning c# coding recently, I have a datagrid connected with sql build to check some service status.
 
I have binded three different table to it, now i want to loop only through the flaged row (ie. if flag=1, it has to check status else it should not check them). 
 
I have planned to do this by adding one text field and a button field on my asp page, when I set flag my page to "0" it should omit that row and loop through rest of the table.
 

 

using (SqlConnection myConnection = new SqlConnection(ConfigurationManager.ConnectionStrings["ConnectionString2"].ToString()))

{

 

DataTable dtJob = new DataTable();

da =

 

new SqlDataAdapter("SELECT originating_server, name, enabled, description, notify_email_operator, date_created, date_modified, last_run_date, last_run_time, owner FROM ServiceStatus", myConnection);

da.Fill(dtJob);

 

DataTable dtService = new DataTable();

da =

 

new SqlDataAdapter("SELECT* FROM WinServ ", myConnection);

da.Fill(dtService);

dtJob.Merge(dtService);

 

DataTable dtwebserv = new DataTable();

da =

 

new SqlDataAdapter("SELECT * FROM webserv ", myConnection);

da.Fill(dtwebserv);

dtJob.Merge(dtwebserv);

gvDetails.DataSource = dtJob;

gvDetails.DataBind();

gvDetails.DataSource = dtJob;

gvDetails.DataBind();

myConnection.Close();

 
pls help me !!!
 
Thanks and regards,
BJ

Answers (3)