I think he crosses 3 forums with this question since he didn't ask a specific question (c#, asp.net, sql).
BUT since you have the mechanism down to execute a query, I don't think its c#. Since you have the page designed, I don't think its asp.net. That leaves SQL (and how you deal with it in c#).
Assuming you're using MSSQL you can do something like (I don't have a compiler with me, so this hasn't been checked for compilation issues):
try
{
query = "Insert into Newuser Select @UserName,@Password,@FullName Where Not Exists (Select * From NewUser x Where x.[UserNameColumn] = @UserName) Select Cast(@@ROWCOUNT as int) As Result";
cmd = new SqlCommand(query, conn);
cmd.Parameters.AddWithValue("@UserName", txtUsername.Text);
cmd.Parameters.AddWithValue("@Password", txtPassword.Text);
cmd.Parameters.AddWithValue("@FullName", txtFullname.Text);
conn.Open();
int rowCnt = Convert.ToInt32(cmd.ExecuteScalar());
conn.Close ();
}
catch(Exception ex)
{
lblErrors.Text =ex.Message.ToString();
}
If the rowcount returns 0 then the username existed, if it returns 1 then you know it didn't. As a recommendation for best practices you should specify the columns in your Insert Into() statement since they're likely to change over time, which could break your query.