the problem is this i have TextBoxes and m trying to convert their value to int by using this code:
SqlCommand cmd = new SqlCommand();
cmd.CommandText = "insert into yearly (pcode,fyyear,yearlyalloc,salary,ta,contigency,nrc,institcharges,others) values (@pcode,@fyyear,@yearlyalloc,@salary,@ta,@contigency,@nrc,@institcharges,@others)";
cmd.Parameters.AddWithValue("@pcode", DropDownList1.SelectedItem.ToString());
cmd.Parameters.AddWithValue("@fyyear", TextBox10.Text +"-"+ TextBox2.Text);
cmd.Parameters.AddWithValue("@yearlyalloc",Convert.ToInt32(TextBox3.Text));
cmd.Parameters.AddWithValue("@salary", int.Parse(TextBox4.Text));
cmd.Parameters.AddWithValue("@ta", int.Parse(TextBox5.Text));
cmd.Parameters.AddWithValue("@contigency", int.Parse(TextBox6.Text));
cmd.Parameters.AddWithValue("@nrc", int.Parse(TextBox7.Text));
cmd.Parameters.AddWithValue("@institcharges", int.Parse(TextBox8.Text));
cmd.Parameters.AddWithValue("@others", int.Parse(TextBox9.Text));
but i am getting error "Input string was not in a correct format" as i was told that i cant leave a textbox blank with convert.toint32 statement. so i wanna use int.TryPrase statement for inserting data.