I have a web application which has a registration page and it asks for an user id. I have set the userid column as unique in sql server. So If a user enters a user id which is already present in the database then an error message should be thrown (an exception) .Right now the the control is thrown back to visual studio, which is bcoz the exception is not handled
Can someone tell me how to handle the exception: the code for the registration page is below:
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;
public partial class register : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
string str = "";
for (int i = 1900; i < 2012; i++)
{
str = Convert.ToString(i);
year_ddl.Items.Add(str);
}
string ...
Go to the complete details ...