c# - mysql table is not getting updated -


i copying data sql server mysql. load table sql server , table mysql , copy data over. data getting copied new table tables in database remains empty. in advance. here code -

private void writetable(datatable table, string tablename)     {         long maxid=0;         mysql.data.mysqlclient.mysqlcommand cmd = new mysql.data.mysqlclient.mysqlcommand("select * " + tablename, mysqlconn);         mysql.data.mysqlclient.mysqldataadapter adapter = new mysql.data.mysqlclient.mysqldataadapter(cmd);         datatable dest = new datatable();         adapter.fill(dest);         txtmessages.text += table.rows.count.tostring()+"\r\n";         foreach (datarow row in table.rows)         {             datarow newrow = dest.newrow();             newrow.beginedit();             foreach (datacolumn col in table.columns)             {                 newrow[col.caption] = row[col.caption];             }             newrow.endedit();             dest.rows.add(newrow);             maxid = long.parse(row["rowid"].tostring());             txtmessages.text += maxid.tostring() + "\r\n";             setrowid(tablename, maxid);         }         mysql.data.mysqlclient.mysqlcommandbuilder builder = new mysql.data.mysqlclient.mysqlcommandbuilder(adapter);         adapter.deletecommand = builder.getdeletecommand();         adapter.insertcommand = builder.getinsertcommand();         adapter.updatecommand = builder.getupdatecommand();         dest.acceptchanges();         adapter.update(dest);      } 

take on @ question asker had same problem you; resolved removing .acceptchanges(); command. in effect have told buffer changes have been written back, when make more not committed.


Comments

Popular posts from this blog

css - Which browser returns the correct result for getBoundingClientRect of an SVG element? -

gcc - Calling fftR4() in c from assembly -

.htaccess - Matching full URL in RewriteCond -