Click here to Skip to main content
11,805,316 members (68,677 online)
Rate this: bad
Please Sign up or sign in to vote.
See more: C# WPF C#4.0 DataGrid
using C1.WPF.DataGrid;
        public static OleDbConnection connection;
        public static OleDbDataAdapter da;       
        public static DataSet ds = new DataSet();
        public static DataTable dt;
        OleDbCommandBuilder cmd;
        public static string connectionstring = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=D:/Project/A&T.accdb";
        public static string cmdstring;
        private void button1_Click(object sender, RoutedEventArgs e)
            cmdstring = "SELECT*FROM DP";
            connection = new OleDbConnection(connectionstring);
            da = new OleDbDataAdapter(cmdstring, connection);
            dt = new DataTable();
            c1DataGrid1.DataContext = dt;    
        private void button2_Click(object sender, RoutedEventArgs e)

            cmd = new OleDbCommandBuilder(da);
            if (dt.GetChanges() != null)

in this code i use a third party product Component one Datagrid.the problem is while clicking Button2 the change should be updated back to the database. this is not happening.if I replace the c1DataGrid1 with Datagrid of WPF everything working fine what should i do. any sort of help will be appreciated

update is happening only when a cell in any other row is clicked . otherwise it is not happening I want to avoid this situation


Posted 4-Jan-12 2:42am
Edited 4-Jan-12 7:11am

1 solution

Rate this: bad
Please Sign up or sign in to vote.

Solution 1

Haven't used this control so not sure about this but should you use ItemsSource. So:
c1DataGrid1.ItemsSource= dt; 
Also many grid components have a separate method that reflects the changes in the grid to the underlying data source, so check that there isn't anything like that which should be called.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
0 OriginalGriff 315
1 Sergey Alexandrovich Kryukov 200
2 Richard Deeming 200
3 CPallini 160
4 CHill60 150
0 OriginalGriff 3,265
1 Maciej Los 1,990
2 KrunalRohit 1,907
3 CPallini 1,855
4 Richard MacCutchan 1,227

Advertise | Privacy | Mobile
Web03 | 2.8.151002.1 | Last Updated 4 Jan 2012
Copyright © CodeProject, 1999-2015
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100