My field validation doesn't seem to work! Did I miss something here?
<p>I am trying to validate fields so user can't have entered data with empty fields. The problem is that I am still adding empty fields, so my validation isn't working.</p>

<p>First, I am checking is type is selected from a combo box. Then I am checking if which type user picked, and then depending on the type I am checking a fields for empty string before entering a data.</p>

<p>Did I miss something here?</p>

<pre><code>private void btnAddEntry_Click(object sender, EventArgs e)
{
    // Multiple level field validations.
    if (cmbType.SelectedIndex != -1)
    {
        if (cmbType.SelectedIndex == 0 &amp;&amp; 
            (txtUserName.Text != string.Empty || 
            txtPassword.Text != string.Empty))
        {
            string SQL =
                "INSERT INTO PersonalData([Type], [UserName], [Password]) " +
                "VALUES(@Type, @UserName, @Password)";

            InsertData(SQL);
        }
        else if (cmbType.SelectedIndex == 1 &amp;&amp; 
            (txtURL.Text != string.Empty || 
            txtUserName.Text != string.Empty || 
            txtPassword.Text != string.Empty))
        {
            // Creating SQL string. Using [] will prevent any erros
            // that might occur if any other names will be reserved words.
            string SQL =
                "INSERT INTO PersonalData([Type], [URL], [UserName], [Password]) " +
                "VALUES(@Type, @URL, @UserName, @Password)";

            InsertData(SQL);
        }
        else if (cmbType.SelectedIndex == 2 &amp;&amp; 
            (txtSoftwareName.Text != string.Empty || 
            txtSerialCode.Text != string.Empty))
        {
            // Creating SQL string. Using [] will prevent any erros
            // that might occur if any other names will be reserved words.
            string SQL =
                "INSERT INTO PersonalData([Type], [SoftwareName], [SerialCode]) " +
                "VALUES(@Type, @SoftwareName, @SerialCode)";

            InsertData(SQL);
        }
        else
        {
            lblMessage.Text = "Please fill out all required fields!";
        }
    }
    else
    {
        lblMessage.Text = "Please select a type first!";
    }
}
</code></pre>
