private bool validateall()
 {
     RequiredFieldValidator1.Validate();
     RequiredFieldValidator2.Validate();
     RequiredFieldValidator3.Validate();
     RequiredFieldValidator4.Validate();
     RequiredFieldValidator5.Validate();
     RequiredFieldValidator6.Validate();
     RequiredFieldValidator7.Validate();
     RequiredFieldValidator8.Validate();
     RequiredFieldValidator9.Validate();
     RegularExpressionValidator1.Validate();
     RegularExpressionValidator2.Validate();
     RegularExpressionValidator3.Validate();
     RegularExpressionValidator4.Validate();
     RegularExpressionValidator5.Validate();
     RegularExpressionValidator6.Validate();
     RegularExpressionValidator7.Validate();
     CompareValidator1.Validate();
     CompareValidator2.Validate();
     CompareValidator3.Validate();
     if (!RequiredFieldValidator1.IsValid || !RequiredFieldValidator2.IsValid || !RequiredFieldValidator3.IsValid || !RequiredFieldValidator4.IsValid || !RequiredFieldValidator5.IsValid || !RequiredFieldValidator6.IsValid || !RequiredFieldValidator7.IsValid || !RequiredFieldValidator8.IsValid || !RequiredFieldValidator9.IsValid ||
         !RegularExpressionValidator1.IsValid || !RegularExpressionValidator2.IsValid || !RegularExpressionValidator3.IsValid || !RegularExpressionValidator4.IsValid || !RegularExpressionValidator5.IsValid || !RegularExpressionValidator6.IsValid || !RegularExpressionValidator7.IsValid || !CompareValidator1.IsValid || !CompareValidator2.IsValid || !CompareValidator3.IsValid)
     {
         return(false);
     }
     return(true);
 }
    protected void TextBox2_TextChanged(object sender, EventArgs e)
    {
        RegularExpressionValidator7.Validate();                                                                      //유효성검사
        if (RegularExpressionValidator7.IsValid)                                                                     //텍스트박스 내용이 바뀔시 유효성 검사
        {
            string        connectionString = @"server=(local)\SQLExpress;Integrated Security=true;database=db_user"; //서버에 연결
            SqlConnection Con = new SqlConnection(connectionString);
            // SPQ 선언

            // SQL COMMAND OBJECT를 만들고  SQL COMMAND 넣기
            SqlCommand Cmd = new SqlCommand();
            Cmd.Connection = Con;
            try
            {
                // SQL COMMAND 수행하기
                Con.Open();
                // ExecuteNonQuery()문은 CREATE, ALTER, DROP, INSERT, UPDATE, DELETE 문을 수행할때 사용
                Cmd.CommandText = "SELECT id FROM db_user WHERE id = \'" + TextBox2.Text + "\'";

                SqlDataReader reader = Cmd.ExecuteReader(); //select 한 값을 호출
                if (reader.Read())                          //Reader가 Read되면 들어감
                {
                    Label1.Text = "중복 아이디가 존재합니다.";
                }
                else
                {
                    Label1.Text = "";
                }
                Con.Close();
            }
            catch
            {
            }
        }
        else
        {
        }
    }