Exemple #1
0
        public void ShowData(String SelectStatment, String ColumnName, ListBox listView)
        {
            listView.Items.Clear();
            dbConnection dbcon = new dbConnection();

            dbcon.OpenConection();
            SqlDataReader dr = dbcon.DataReader(SelectStatment);

            while (dr.Read())
            {
                listView.Items.Add(dr[ColumnName]);
            }
        }
Exemple #2
0
        public void ListData(String SelectStatment, String ColumnName1, String ColumnName2, ListView listView)
        {
            listView.Items.Clear();
            dbConnection dbcon = new dbConnection();

            dbcon.OpenConection();
            SqlDataReader dr = dbcon.DataReader(SelectStatment);

            while (dr.Read())
            {
                listView.Items.Add(dr[ColumnName1].ToString());
                listView.Items.Add(dr[ColumnName2].ToString());
            }
        }
Exemple #3
0
        private void cmbCategory_MouseUp(object sender, MouseEventArgs e)
        {
            cmbCategory.Items.Clear();
            dbConnection dbcon = new dbConnection();

            dbcon.OpenConection();
            SqlDataReader dr = dbcon.DataReader("select Category from tbMeCategory");

            dr.Read();
            if (dr.HasRows)

            {
                cmbCategory.Items.Add(dr["Category"]).ToString();
                while (dr.Read())
                {
                    cmbCategory.Items.Add(dr["Category"]).ToString();
                }
            }
        }
Exemple #4
0
        private void cmbRType_MouseUp(object sender, MouseEventArgs e)
        {
            cmbRType.Items.Clear();
            dbConnection dbcon = new dbConnection();

            dbcon.OpenConection();
            SqlDataReader dr = dbcon.DataReader("select RType from tbRoomType");

            dr.Read();
            if (dr.HasRows)

            {
                cmbRType.Items.Add(dr["RType"]).ToString();
                while (dr.Read())
                {
                    cmbRType.Items.Add(dr["RType"]).ToString();
                }
            }
        }
Exemple #5
0
        public void RoomModule_Load(object sender, EventArgs e)
        {
            listViewShow lst = new listViewShow();

            lst.ShowData("select RoomNo from tbRoom", "RoomNo", lstView);

            dbConnection dbcon = new dbConnection();

            dbcon.OpenConection();
            SqlDataReader dr = dbcon.DataReader("select RType from tbRoomType");

            dr.Read();
            if (dr.HasRows)

            {
                cmbRType.Items.Add(dr["RType"]).ToString();
                while (dr.Read())
                {
                    cmbRType.Items.Add(dr["RType"]).ToString();
                }
            }
        }
Exemple #6
0
        public int getID(string Selectstatment, string ColumName)
        {
            dbConnection dbcon = new dbConnection();

            dbcon.OpenConection();
            SqlDataReader dr = dbcon.DataReader(Selectstatment);

            dr.Read();
            string ID = null;

            if (dr.HasRows)
            {
                ID = dr[ColumName].ToString();
                if (ID == null)
                {
                    int y = 1;
                    return(y);
                }

                while (dr.Read())
                {
                    ID = dr[ColumName].ToString();
                }
                if (ID == null)
                {
                    int y = 2;
                    return(y);
                }
                if (ID != null)
                {
                    int y = Int32.Parse(ID) + 1;
                    return(y);
                }
            }

            return(1);
        }