error occuring after storing data
Hi friends,
i am getting error after performing calculation and after storing data in database
The error is
formatExeption was unhandled
Input string was not in a correct format
the error is on
number2 = Convert.ToInt32(txtnumdays.Text);
the logic i have used to perform calculation is
string maxleave = "";
int number1;
int number2;
int returnValue = 0;
qry = "Select MaxLeave from LeaveMaster where LeaveName = '" + cmbLeave.Text.ToString() + "' ";
number2 = Convert.ToInt32(txtnumdays.Text);
DBCom.getData(qry);
if (DBCom.rdr.HasRows)
{
while (DBCom.rdr.Read())
{
maxleave = DBCom.rdr["MaxLeave"].ToString();
number1 = int.Parse(maxleave);
returnValue = Subtract(number1, number2);
txtLvslft.Text = returnValue.ToString();
please help how to solve this error
thanks