Creating a Registration form: In asp.net
<p>Im new to Asp.net:</p>

<p>Im creating a online telephone bill payment form. A new user has to register to get a valid id,
In the sqlserver i created a table which has only two columns as Phone_number and User_name. I have set the Phone_number column as unique. Just to avoid re-registration of a user.</p>

<p>I have checked the form during runtime using asp.net web page but, i get some error in the code.</p>

<p>Also i have to display a message that "the phone number already exists."</p>

<p>my code is as follows. Is there a better way??</p>

<p>try
        {</p>

<pre><code>        string s = " insert into new_user values(@Phone_number,@name)";
        cmd = new SqlCommand(s, con);
        cmd.Parameters.AddWithValue(@"Phone_number", TextBox1.Text);
        cmd.Parameters.AddWithValue(@"Name", TextBox2.Text);

        cmd.ExecuteNonQuery();
    }
    catch (SqlException ex)
    {

        Console.WriteLine(ex);
        MessageBox.Show("Phone Number already exist, Enter a different phone number");
    }
    TextBox1.Text = TextBox2.Text = null;


    Session["a"] = TextBox1.Text;
    Response.Redirect("registration.aspx");


} 
</code></pre>

<p>in the above code if i dont user the Console.Writeline(); i get an error in the ExecuteNonQuerry() part.</p>
