NEXT Registration

using System;

using System.Data;

using System.Configuration;

using System.Collections;

using System.Web;

using System.Web.Security;

using System.Web.UI;

using System.Web.UI.WebControls;

using System.Web.UI.WebControls.WebParts;

using System.Web.UI.HtmlControls;

using System.Data.SqlClient;

public partial class Student_ Registration: System.Web.UI.Page

{

DBMgt objDBMgt = new DBMgt();

protected void Page_Load(object sender, EventArgs e)

{

}

protected void btnCreate_Click(object sender, EventArgs e)

{

try

{

string strPWD = FormsAuthentication.HashPasswordForStoringInConfigFile(txtpasswd.Text.Trim(), "SHA1");

string strLoginName = txtEnrollNo.Text.Trim() + txtFName.Text.Trim();

SqlParameter[] parList = new SqlParameter[8];

parList[0] = new SqlParameter("@cENo", txtEnrollNo.Text.Trim());

parList[1] = new SqlParameter("@cFName", txtFName.Text.Trim());

parList[2] = new SqlParameter("@cLName", txtLName.Text.Trim());

parList[3] = new SqlParameter("@cProgram", DropDownList1.SelectedItem.Value);

parList[4] = new SqlParameter("@cCourse", DropDownList2.SelectedItem.Value);

parList[5] = new SqlParameter("@iStudyCenCode", txtStudyCenCode.Text.Trim());

parList[6] = new SqlParameter("@vLoginName", strLoginName);

parList[7] = new SqlParameter("@vpasswd", strPWD);

bool i= objDBMgt.ExecuteNonQueryStoreProc("insStudent",parList);

if (i ==true )

lblMsg.Text = "New Criteria Created!!!";

else

lblMsg.Text = "Criteria Not Created!!!";

}

catch (SqlException SqlEx) // This Catch block is used to Catch the Sql or Backend related Problem

{

lblMsg.Text = "Sorry for inconvenience!!!!<br>Following BackEnd related Error Occured: +'" + SqlEx.Message + "'<br>Try Again!!!";

}

catch (Exception ex) // This Block is used to catch any exception occured if not related to upper exception

{

lblMsg.Text = "Sorry for inconvenience!!!!<br>Following Error Occured: +'" + ex.Message + "'<br>Try Again!!!";

}

}

}