dsDiscounts.Tables[1].Columns[0] returns the definition of the column (data type, signature, etc., defined by the DataColumn instance). Of course, converting a column definition to an integer fails.
You need a cell value from some row in the table (suppose the first row). You must use Rows to access table rows. After you get the required DataRow using the index, you can access the cells in the row by index , column name, column object, etc. For example, getting the cell value of the first row by column name:
dsDiscounts.Tables[1].Rows[0]["CONTACT_ID"]
Sergey Berezovskiy
source share