Try with this,
try
{
int n = cmd.ExecuteNonQuery();
if(n > 0)
Response.Write("Record inserted.");
}
catch(Exception ex)
{
Response.Write(ex.ToString());
}
and on
Page_Load()
protected void Page_Load(object sender, EventArgs e)
{
if(!IsPostBack)
studentdetails();
}
-KR