Beispiel #1
0
        private void cmdhome_Click(object sender, EventArgs e)
        {
            mainform b = new mainform();

            b.ShowDialog();
            BindData();
        }
Beispiel #2
0
        private void cmdlogin_Click(object sender, EventArgs e)
        {
            mainform f = new mainform();
            string   s = "select count(*) from login where name='" + this.txtuser.Text + "' and pass='******'";

            System.Data.SqlClient.SqlConnection con = new System.Data.SqlClient.SqlConnection();
            con.ConnectionString = "Data source=.;Initial catalog =amlak;Integrated security=true";
            con.Open();
            System.Data.SqlClient.SqlCommand cmd = new System.Data.SqlClient.SqlCommand(s, con);
            int d = Convert.ToInt16(cmd.ExecuteScalar());

            if (d == 0)
            {
                MessageBox.Show("نام کاربری یا کلمه عبور شما معتبر نیست"); txtuser.Text = ""; txtpass.Text = "";
            }
            else
            {
                f.Show();
                this.Hide();
            }
        }