Filling data at a particular location in a Data Table in C#

后端 未结 3 2045
故里飘歌
故里飘歌 2021-01-15 22:30

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

3条回答
  •  深忆病人
    2021-01-15 23:13

    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.

提交回复
热议问题