I have a "phone" area in my database and data type is char(11).
I need to make a conversion in ASP.NET C# as below:
char PhoneNumber = char.Parse((item.FindControl("TxtPhoneNumber") as TextBox).Text);
but I get an error:
An exception of type 'System.FormatException' occurred in mscorlib.dll but was not handled in user code
Additional information: String must be exactly one character long.
How can I resolve this error?
charis a type which represents one character. You cannot parse a string into one character except the string is exactly one char long (as the error message mentions).