示例#1
0
        //**********************************************************************************************************
        //**                                          Clear a Table                                               **
        //**********************************************************************************************************

        private void btnEmptyTable_Click(object sender, EventArgs e)
        {
            //toolStripStatusLabelStatus.Text = "Deleting ...";
            Cursor.Current = Cursors.WaitCursor;

            Cell cell = new Cell();

            cell = comboBoxCell.SelectedItem as Cell;

            if (cell.Index > 10)
            {
                return;
            }

            DB_Adapter adapter = new DB_Adapter();

            adapter.ClearTable(cell.Index);

            DataTable dt = new DataTable();

            dt = adapter.ReadLocation(cell.Index);

            dataGridViewG20x0.DataSource = dt;

            Cursor.Current = Cursors.Default;
            toolStripStatusLabelStatus.Text = string.Format("Table {0}; {1} rows", cell.Name, dt.Rows.Count);
        }
示例#2
0
        //**********************************************************************************************************
        //**                                    Load DB table from network                                        **
        //**********************************************************************************************************

        private void btnLoadTable_Click(object sender, EventArgs e)
        {
            //toolStripStatusLabelStatus.Text = "Updating DB ...";
            Cursor.Current = Cursors.WaitCursor;

            SensorCollection sensors = new SensorCollection();

            Cell cell = new Cell();

            cell = comboBoxCell.SelectedItem as Cell;

            if (cell.Index > 10)
            {
                return;
            }

            DB_Adapter adapter = new DB_Adapter();

            adapter.ClearTable(cell.Index);

            Reader reader = new Reader();

            sensors = reader.ReadCell(cell.Location);

            adapter.InsertIntoTable(sensors, cell.Index);

            DataTable dt = new DataTable();

            dt = adapter.ReadLocation(cell.Index);

            dataGridViewG20x0.DataSource = dt;

            DbDate();

            Cursor.Current = Cursors.Default;
            toolStripStatusLabelStatus.Text = string.Format("Table {0}; {1} rows", cell.Name, dt.Rows.Count);
        }