コード例 #1
0
        public void DSB()
        {
            cbMB.Items.Clear();

            List <String> ds = Ban.DSTrong();

            if (ds.Count == 0)
            {
                cbMB.Items.Add("Không");
                btTao.Enabled = false;
            }
            else
            {
                foreach (string i in ds)
                {
                    cbMB.Items.Add(i);
                }

                cbMB.SelectedIndex = 0;
            }
        }
コード例 #2
0
        public void TestDSTrong()
        {
            DataSet dsHienThi = new DataSet();

            string l = "select * from Ban where TinhTrang = 'Trống'";

            strcon.Open();

            OleDbDataAdapter daShowData = new OleDbDataAdapter(l, strcon);

            daShowData.Fill(dsHienThi);

            daShowData.Dispose();

            strcon.Close();

            int expected = dsHienThi.Tables[0].Rows.Count;

            int actual = Ban.DSTrong().Count;

            Assert.AreEqual(expected, actual);
        }