Abdoul Rahim
Member
- Joined
- Oct 16, 2017
- Messages
- 15
- Programming Experience
- Beginner
Can somme one explaine me this " if (dt.row [0][0].tostring()=="this"){console.write ("this");}. High Tof or culumns those it refers To.?
I have no idea what you just said.High Tof or culumns those it refers To.?
That is almost certainly not a faithful representation of the code you want explained. It is a very good idea to copy and paste code so that you know that you're getting EXACTLY the right thing. If you type it out by hand then you can make mistakes, and you have made at least two there I think. I believe that the actual code would be this:Can somme one explaine me this " if (dt.row [0][0].tostring()=="this"){console.write ("this");}.
if (dt.Rows[0][0].ToString() == "this") { Console.Write ("this"); }
dt.Rows[0]is getting the item at index 0 in the Rows collection of 'dt', i.e. it is getting the first DataRow in the DataTable. A DataRow itself is a collection of field values for the columns in the table. This:
dt.Rows[0][0]is getting the first row in the table and then getting the value of the first field in that row. You could expand that into two lines like this:
var row = dt.Rows[0]; var fieldValue = row[0];