what is the meaning of
1. ds.Tables[0].Rows.Count > 0
2.ds.Tables[0].Rows[0]["column_name"].ToString();
3.dt.rows.count>0
with example
C#.net
2 Answers
Know the answer? Post it. Somebody with the same question will find it here.
Know the answer? Post it. Somebody with the same question will find it here.
Vishal GilbileRank #269 · 9.4K pointsPosted Apr 1, 2013, 10:35 PM EDT
The following lines conclude the following things.
Pramod Shivhare7 pointsPosted Apr 2, 2013, 3:01 AM EDT
1. ds.Tables[0].Rows.Count > 0
Ans : Data set can contains number of tables, here ds is data set and table [0] is pointing to 1st table index in data set. Rows.Count is a property in data table which will return you the number of rows in data table. The above statement ds.Tables[0].Rows.Count is returning you the number of rows in first table of data set ds. This is the conditional statement, here one is checking total number of rows with predefined value in this case it 0.
2.ds.Tables[0].Rows[0]["column_name"].ToString();
Ans : This statement will return you the first rows value of ds.Tables[0] table, and for which column you want value u can specify instead of "column_name"
3.dt.rows.count>0
Ans : the first statement and this statment has no diffrence. In 1 data table was from data set object and here we are directly using data tables object.