Hi All
Do I need to do a “get data row” or is there a way of doing it like “DataTable(RowIndex,ColumnIndex)” and it will return that data?
Example: When you want to read data in a messagebox.
Hi All
Do I need to do a “get data row” or is there a way of doing it like “DataTable(RowIndex,ColumnIndex)” and it will return that data?
Example: When you want to read data in a messagebox.
You can use that as well.
You can do this like as below:
Your_Datatable.Rows(<Your_Row_index>).Item(<Your_Col_Index)
For Your understanding if you want to fetch First Row and First column of a datatable Then you can use like this:
Your_Datatable_Name.Rows(0).Item(0)
Regards…!!
Aksh
You can additionally use dataTable(0)(0)
. Note though that this way of accessing data gives you Object type variables, if you know the specific data type at the given position, you can access it by its actual type with for example dataTable(0).Field(Of String)(0)
or row.Field(Of DateTime)(0)
for String or DateTime contents. Instead of the integer index you can also always use the column name string or a DataColumn variable, for example if you are iterating For Each column in dataTable.Columns
.
Awesome thx guys. this will help a lot as the data is known and only a small amount of data.