Error is simple you have access a rows/column index which is not exist in dataset/datatable collection, in your code it looks you have used '
dtResult' variable, which is not defined anywhere in your code, I think you need to change your code as follows
CustomerID = Convert.ToInt32(dtResult.Rows[0][0])
CustomerID = Convert.ToInt32(dt.Rows[0][0])