hi, i am doing a project with SQL server 2005 and VS 2008,
I have parsed a textbox text to long variable(phone number), because the backend stores the phone number in bigint.
long phone = long.Parse(TextBox4.Text);
This works fine when i insert my phone number, but if a person doesn't know or doesn't want to insert it, i have the option for phone number as null.
If i just press the submit button without entering the phone number i get this error!!?
Server Error in '/' Application.
Input string was not in a correct format.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.FormatException: Input string was not in a correct format.
Source Error:
Line 48: string deptName = TextBox2.Text;
Line 49: string deptLoc = TextBox3.Text;
Line 50: long phone = long.Parse(TextBox4.Text);
Line 51: string flag = "";
Please rectify my error, I am not understanding which other method to parse it!