Why I'm getting Incorrect syntax near ')' error?

I'm trying to create a registration page using C# on Visual Basic 2012. When I debug I get 0 errors, but when I try to register an account I get the following error.

"Incorrect syntax near ')'"

If I try to create an account with an existing username it says that username already exist. So I'm able to connect to the SQL server, but I'm not sure where I went wrong.

This registration page should create accounts in my DB DNMembership> Table> Accounts

Here is my code I'm working with.

{
    SqlConnection con = new SqlConnection(ConfigurationManager.ConnectionStrings["RegDNMembershipConnectionString"].ConnectionString);
    con.Open();
    string insCmd = "Insert into Accounts (AccountName, Passphrase, EmailAddress, FullName, Country)";
    SqlCommand insertUser = new SqlCommand(insCmd, con);
    insertUser.Parameters.AddWithValue("@AccountName", TextBoxUN.Text);
    insertUser.Parameters.AddWithValue("@Passphrase", TextBoxPass.Text);
    insertUser.Parameters.AddWithValue("@EmailAddress", TextBoxEA.Text);
    insertUser.Parameters.AddWithValue("@FullName", TextBoxFN.Text);
    insertUser.Parameters.AddWithValue("@Country", DropDownListCountry.SelectedItem.ToString());

    try
    {
        insertUser.ExecuteNonQuery();
        con.Close();
        Response.Redirect("Login.aspx");
    }
    catch(Exception er)
    {
        Response.Write("<b>Something Really Bad Happened... Please Try Again.< /br></b>");
        Response.Write(er.Message);
}

What did I do wrong?

Jon Skeet
people
quotationmark

You haven't specified any parameters in your SQL, or a VALUES section - you're saying "I want to insert into these fields..." but not what you want to insert. It should be something like:

string insCmd =
   "Insert into Accounts (AccountName, Passphrase, EmailAddress, FullName, Country) "
 + "Values (@AccountName, @Passphrase, @EmailAddress, @FullName, @Country");

people

See more on this question at Stackoverflow