How can I convert this column value to an integer?

Posted by Kevin on Stack Overflow See other posts from Stack Overflow or by Kevin
Published on 2010-04-07T12:00:39Z Indexed on 2010/04/07 12:03 UTC
Read the original article Hit count: 159

Filed under:

My C# code looks like this:

myNum = dt.Columns[0];

myNum is an integer and dt is a datatable. The value in column 0 of dt is a string ("12"), but I'd like to convert it to an integer. How can I do this? I've tried:

myNum = int.Parse(dt.Columns[0]);

...but that doesn't work. Any ideas?

© Stack Overflow or respective owner

Related posts about c#