if (dr.HasRows) { while (dr.Read()) //int i=0, j=0; { Src_EpId = dr[0].ToString(); //textBox13.Text = Src_EpId+"\n"; Device_ID = dr[1].ToString(); // textBox1.Text = Device_ID; Control_ID = dr[2].ToString(); Control_Type = dr[3].ToString(); Current_Value = dr[4].ToString(); Message_State = dr[5].ToString(); Change_Value = dr[6].ToString(); Location = dr[7].ToString(); Image_Url = dr[8].ToString(); // total columns = 9. rows = 5. How to access row2 column1, row2 column2 etc. individually?
DataTable dt = new DataTable(); dr.Load(dt); foreach(DataRow dr in dt.Rows) { dr["columnName"]; // and other columns you can get }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)