When you're getting an error always say what line the error happens on, and use the debugger to step through your code as it will help solve these issues. If the error is on this line
CustomerID = Convert.ToInt32(dtResult.Rows[0][0]),
Then chances are dtResult has no rows in it. Did you mean
CustomerID = Convert.ToInt32(dt.Rows[0][0]),
instead?