How can I convert String to Int?

后端 未结 30 2259
情歌与酒
情歌与酒 2020-11-21 05:35

I have a TextBoxD1.Text and I want to convert it to an int to store it in a database.

How can I do this?

30条回答
  •  野趣味
    野趣味 (楼主)
    2020-11-21 06:16

    You can convert a string to int in C# using:

    Functions of convert class i.e. Convert.ToInt16(), Convert.ToInt32(), Convert.ToInt64() or by using Parse and TryParse Functions. Examples are given here.

提交回复
热议问题