public void inserirConta(Conta c) { DataContext dc = getDataContext(); Table<Conta> tc = dc.GetTable<Conta>(); tc.InsertOnSubmit(c); dc.SubmitChanges(); }
public void inserirConta(Conta c) { DataContext dc = new DataContext(@"Data Source=wv-toshiba\instancia1;Initial Catalog=ASI;User ID=sa;Password=123"); Table<Conta> tc = dc.GetTable<Conta>(); tc.InsertOnSubmit(c); dc.SubmitChanges(); }
public void alterarConta(Conta c) { DataContext dc = getDataContext(); Table<Conta> tc = dc.GetTable<Conta>(); tc.Attach(c, true); try { dc.SubmitChanges(ConflictMode.ContinueOnConflict); } catch (ChangeConflictException) { dc.ChangeConflicts.ResolveAll(RefreshMode.KeepCurrentValues); // last -in - wins dc.SubmitChanges(); } }
public void alterarConta(Conta c) { DataContext dc = new DataContext(@"Data Source=wv-toshiba\instancia1;Initial Catalog=ASI;User ID=sa;Password=123"); Table<Conta> tc = dc.GetTable<Conta>(); tc.Attach(c, true); try { dc.SubmitChanges(ConflictMode.ContinueOnConflict); } catch (ChangeConflictException e) { dc.ChangeConflicts.ResolveAll(RefreshMode.KeepCurrentValues); // last -in - wins dc.SubmitChanges(); } }