I am working with C# and Asp.Net. Is it possible to fill a particular location of a Data table.
I have a Data Table dt, and is contains this this k
You can address individual cells with:
dt.Rows[rowIndex][columnIndex]
The column can be addressed by name as well:
dt.Rows[rowIndex]["customer2"]
Mind that the output is of type Object
, so you might need to cast it to the appropriate data type if you want to read its value.
You can actually do this:
Code example:
Dim vRows() As DataRow
vRows = dt.Select("DATA='Shop1'")
vRows(0)("customer2") = "YourDataHere"
This way you create an array of rows which is a reference to the DataTable, so you can directly edit the array.
If you write this table to a database, don't forget to set up a DataAdapter and use the .Update method.
Yes you must specify index roww and column, suggest you this link http://msdn.microsoft.com/en-us/library/z16c79x4(v=vs.110).aspx