i have a datatable and i need to convert one of its column into int.
Convert.ToInt32(dt.Columns["xxx"])
i tried this but error occours
plz help
i have a datatable and i need to convert one of its column into int.
Convert.ToInt32(dt.Columns["xxx"])
i tried this but error occours
plz help
Know the answer? Post it. Somebody with the same question will find it here.
Answer a question in the forums and earn +20 SHARP for every answer.
See unanswered questions
DevSocialUpcoming · 3rd editionAI Agents ConferenceDec 1–3, 2026Live onlineFree to attend5days leftRegister
Jignesh KumarRank #91 · 22.9K reputationPosted Nov 22, 2022, 3:36 AM EST
Hi,
use this one,
int myNum = int.Parse(Convert.Tostring(dt.Columns["xxx"]) ?? 0); Or int myNum = int.Parse(dt.Columns["xxx"].ToString());Naresh BeniwalRank #365 · 6.8K reputationPosted Nov 22, 2022, 4:31 AM EST
https://stackoverflow.com/questions/2592180/how-can-i-convert-this-column-value-to-an-integer