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 42: SqlCommand cmd = new SqlCommand("insert into students(StudentName,Age) values(@StudentName,@Age)",con);
Line 43: cmd.Parameters.AddWithValue("@StudentName",txtName.Text);
Line 44: cmd.Parameters.AddWithValue("@Age",Convert.ToInt32(txtAge.Text));
Line 45: con.Open();
Line 46: int rows = cmd.ExecuteNonQuery();
Source File: C:\Users\ajayb\source\repos\WebApplicationpract7c\WebApplicationpract7c\InsertDelete.aspx.cs Line: 44