Ejemplo n.º 1
0
        private void button1_Click(object sender, EventArgs e)
        {
            string student_name    = textBox_student_name.Text;
            string student_gender  = textBox_gender.Text;
            string student_address = textBox_student_address.Text;

            string query = "insert into UMS_tbl_Students(Student_Name,Gender,Student_Address)VALUES('" + student_name + "','" + student_gender + "','" + student_address + "')";


            using (DBhelper1 dbHelper = new DBhelper1())
            {
                dbHelper.ExecuteQuery(query);
            }
            LoadProductGridView();
        }
Ejemplo n.º 2
0
        void LoadProductGridView()
        {
            dataGridView1.Rows.Clear();
            string    query = "select Student_ID,Student_Name,Gender,Student_Address from UMS_tbl_Students ";
            DataTable dt    = new DataTable();

            using (DBhelper1 dbHelper = new DBhelper1())
            {
                dt = dbHelper.GetRecords(query);
            }

            foreach (DataRow row in dt.Rows)
            {
                dataGridView1.Rows.Add(row[0], row[1], row[2], row[3]);
            }
        }
Ejemplo n.º 3
0
        private void Login_Click(object sender, EventArgs e)
        {
            string userName = textBox_user_name.Text;
            string password = textBox_password.Text;
            //Control.if empty or remove special charctaee

            string query = string.Format("select * from UMS_tbl_Users where Users='{0}' and Passwords='{1}'", userName, password);

            DataTable dt = new DataTable();

            using (DBhelper1 dbhelper = new DBhelper1())
            {
                dt = dbhelper.GetRecords(query);
            }
            if (dt.Rows.Count > 0)
            {
                Main frm = new Main();
                frm.ShowDialog();
            }
        }