Hello everyone I am making a simple registration page and i want to store values in database

here is my code

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data.SqlClient;
using System.Configuration;

namespace PatientSystem
{
    public partial class Registration : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
              
        }

       
        
        

        protected void Button1_Click(object sender, EventArgs e)
        {
            
        SqlConnection con=new SqlConnection(ConfigurationManager.ConnectionStrings["StaffConnectionString"].ConnectionString);
            con.Open();
            string cmd="Insert into RegistrationTable(FirstName,MiddleName,LastName,DateOfBirth,Age,Gender,Address,TelephoneNo,EmailID) values(@FirstName,@MiddleName,@LastName,@DateOfBirth,@Age,@Gender,@Address,@TelephoneNo,@EmailID)";
            SqlCommand insert=new SqlCommand(cmd,con);
            insert.Parameters.AddWithValue("@FirstName",TextBox1.Text);
            insert.Parameters.AddWithValue("@MiddleName",TextBox2.Text);
            insert.Parameters.AddWithValue("@LastName",TextBox3.Text);
            insert.Parameters.AddWithValue("@DateOfBirth",TextBox8.Text);
            insert.Parameters.AddWithValue("@Age    ",TextBox4.Text);
            insert.Parameters.AddWithValue("@Gender",RadioButtonList1.Text);
            insert.Parameters.AddWithValue("@Address",TextBox5.Text);
            insert.Parameters.AddWithValue("@TelephoneNo", TextBox6.Text);
            insert.Parameters.AddWithValue("@EmailID",TextBox7.Text);
        
        try
        {
            insert.ExecuteNonQuery();
            con.Close();

        
        }
         catch(Exception er)

        {
             Response.Write("Something went wrong...Try contacting your administrator");

         }
           
            finally
        {
        }
        }
    }
}

Now the gender here is a RadioButtonList and date of birth is an ajax calender
how to store these values in database
I have created a table with the above fields...have i made any error in declaration of there data type???

FirstName=Varchar(50)
MiddleName=Varchar(50)
LastName==Varchar(50)
DateOfBirth=datetime2(7)
Age=int
Gender==Varchar(50)
Address==Varchar(50)
TelephoneNo=decimal(18,0)
EmailID=nvarchar(50)
ID=int-----------------Primary Key

Gender == CHAR(1) --- Either 'F' or 'M'

I am still not able to store data in database.....I cant find submitted information in table...
can anyone help???

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.