public static int SaveTable(DataTable table, ref SqlDataAdapter sqlDataAdapter) { int nRet = 1; if (Program.EnableRemoting) { mDataTableProxy.SaveTable(table, sqlDataAdapter.SelectCommand.CommandText); } else { SqlCommandBuilder cmdBuilder = new SqlCommandBuilder(sqlDataAdapter); sqlDataAdapter.UpdateCommand = cmdBuilder.GetUpdateCommand(); nRet = sqlDataAdapter.Update(table); } table.AcceptChanges(); return(nRet); }
public static int SaveTable(DataTable table, string sql, SqlConnection conn) { int nRet = 1; if (Program.EnableRemoting) { nRet = mDataTableProxy.SaveTable(table, sql); } else { SqlDataAdapter adapter = new SqlDataAdapter(sql, conn); SqlCommandBuilder cmdBuilder = new SqlCommandBuilder(adapter); adapter.UpdateCommand = cmdBuilder.GetUpdateCommand(); nRet = adapter.Update(table); } table.AcceptChanges(); return(nRet); }