Exemplo n.º 1
0
        private void cbo_MaThuoc_SelectedIndexChanged(object sender, EventArgs e)
        {
            string        strsel = "select GiaBan from Thuoc where TenThuoc LIKE N'%" + cbo_MaThuoc.Text.Trim() + "%'";
            SqlDataReader dr     = conn.excuteReader(strsel);

            while (dr.Read())
            {
                txt_DonGia.Text = dr["GiaBan"].ToString();
            }
            dr.Close();
            conn.ClosedConnection();
        }
Exemplo n.º 2
0
        public string getID(string user, string pass)
        {
            string id = "";

            try
            {
                conn.OpenConnection();
                string        strSql = "SELECT * FROM NhanVien WHERE userName ='******' and password='******'";
                SqlDataReader dr     = conn.getReader(strSql);
                while (dr.Read())
                {
                    id = dr["TenNV"].ToString();
                }
            }
            catch (Exception)
            {
                MessageBox.Show("That bai khi ket noi");
            }
            finally
            {
                conn.ClosedConnection();
            }
            return(id);
        }