Scenario:
- User. Changes in gridControl1 in any line the valueon to the value off;
- Code. Hides the line in gridControl1 and displays the line ingridControl2;
I tried this using DataView, but it does not work.
How to make the script work?
- public class ConectDB
- {
- public DataTable dt;
-
- static OleDbDataAdapter adapter;
- static OleDbCommandBuilder cmdBuilder;
-
- static GridControl gridControlThis;
-
- public DataView dv1;
- public DataView dv2;
-
- public ConectDB()
- {
-
- }
-
- public void connect()
- {
- string catBD = @"z:\vs\csharp\prb\718\01_pr\01_pr\01_pr\718.01.01.accdb";
- string conBD = string.Format("Provider=Microsoft.ACE.OLEDB.12.0;Data Source={0}", catBD);
-
- OleDbConnection connection = new OleDbConnection(conBD);
-
- connection.Open();
-
- string query1 = "SELECT * FROM TableGrid_00";
- OleDbCommand cmd1 = new OleDbCommand(query1, connection);
-
- dt = new DataTable();
-
-
- try
- {
- adapter = new OleDbDataAdapter(cmd1);
- cmdBuilder = new OleDbCommandBuilder(adapter);
- adapter.UpdateCommand = cmdBuilder.GetUpdateCommand();
- adapter.InsertCommand = cmdBuilder.GetInsertCommand();
-
- }
- catch (Exception ex)
- {
- string s = ex.Message;
- throw;
- }
-
- adapter.Fill(dt);
-
- dv1 = new DataView(dt);
- dv1.RowFilter = "groupWork = '???'";
-
- dv2 = new DataView(dt);
- dv2.RowFilter = "groupWork = '????'";
- }
- }
-
- public partial class Frm13UC : UserControl
- {
-
- ConectDB conectDB;
-
-
-
- public Frm13UC()
- {
- InitializeComponent();
- }
-
- private void Frm12_Load(object sender, EventArgs e)
- {
-
- conectDB = new ConectDB();
-
- }
-
-
- public void FillGrid_1()
- {
- conectDB.connect();
-
- gridControl1.DataSource = conectDB.dv1;
-
- gridView1.BestFitColumns();
- }
-
-
- public void FillGrid_2()
- {
- conectDB.connect();
-
- gridControl2.DataSource = conectDB.dv2;
-
- gridView2.BestFitColumns();
- }
- }