Example #1
0
        private void fillGrid(String query, int i)
        {
            dc.openCon();
            SqlDataAdapter da = dc.selectTable(query);
            DataTable      dt = new DataTable();

            da.Fill(dt);
            if (i == 1)
            {
                metroGrid1.DataSource = dt;
                DataGridViewButtonColumn col = new DataGridViewButtonColumn();
                col.UseColumnTextForButtonValue = true;
                col.Text = "Delete";
                col.Name = "deleteUsr";
                metroGrid1.Columns.Add(col);
                dc.closeCon();
            }
            else
            {
                metroGrid2.DataSource = dt;
                DataGridViewButtonColumn col = new DataGridViewButtonColumn();
                col.UseColumnTextForButtonValue = true;
                col.Text = "Delete";
                col.Name = "deleteUsr";
                metroGrid2.Columns.Add(col);
                dc.closeCon();
            }
        }
Example #2
0
        private void metroButton5_Click(object sender, EventArgs e)
        {
            String  command = "RESTORE DATABASE bisdb FROM DISK ='" + metroTextBox1.Text + "' WITH REPLACE";
            DataCon dc4     = new DataCon();

            dc4.openCon();
            SqlCommand cmd = new SqlCommand(command, dc4.getCon());

            dc4.closeCon();
            dc4.dispCon();
            MessageBox.Show("SuccessFully Restored");
        }