Exemplo n.º 1
0
        private void btn_accountcheck_Click(object sender, EventArgs e)
        {
            SqlConnection con = new SqlConnection(SqlLink.linkmethod());
            SqlCommand    cmd = new SqlCommand(SqlSelect.UserCheckmethod(), con);

            cmd.Parameters.AddWithValue("@username", tb_account.Text);
            con.Open();
            SqlDataReader dataReader = cmd.ExecuteReader();
            DataSet       ds         = new DataSet();

            con.Close();
            if (dataReader.Read())
            {
                if (dataReader[0].ToString() == "0")
                {
                    MessageBox.Show("帳號可以使用");
                    return;
                }
                else
                {
                    MessageBox.Show("帳號已被使用");
                    return;
                }
            }
        }