Пример #1
0
        public string onChangeCboBox(String variable, bool checkType)
        {
            string result   = "";
            string sqlQuery = checkType ? ("select * from NhanVien2 nv where nv.MaNV = '" + variable + "'") : ("select * from KhachHang2 kh where kh.MaKH = '" + variable + "'");

            SqlConnection con = data.getConnect();

            con.Open();
            SqlCommand    command = new SqlCommand(sqlQuery, con);
            SqlDataReader reader  = command.ExecuteReader();

            if (reader.HasRows)
            {
                while (reader.Read())
                {
                    result = reader.GetString(1);
                }
            }
            con.Close();
            return(result);
        }
Пример #2
0
        public int findPrice(String maHH)
        {
            int    result   = 0;
            string sqlQuery = "select * from Hang2 h where h.MaHH = '" + maHH + "'";

            SqlConnection con = data.getConnect();

            con.Open();
            SqlCommand    command = new SqlCommand(sqlQuery, con);
            SqlDataReader reader  = command.ExecuteReader();

            if (reader.HasRows)
            {
                while (reader.Read())
                {
                    result = reader.GetInt32(4);
                }
            }
            con.Close();
            return(result);
        }
Пример #3
0
        public string onChangeCboBox(String variable)
        {
            string result   = "";
            string sqlQuery = "select * from TrinhDo2 td where td.MaTrinhDo = '" + variable + "'";

            SqlConnection con = data.getConnect();

            con.Open();
            SqlCommand    command = new SqlCommand(sqlQuery, con);
            SqlDataReader reader  = command.ExecuteReader();

            if (reader.HasRows)
            {
                while (reader.Read())
                {
                    result = reader.GetString(1);
                }
            }
            con.Close();
            return(result);
        }