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=MIRANDA-LAPTOP\SQL2012DEINST1;Initial Catalog=ASI;Integrated Security=true");//TODO: CONFIGURATION FILE! 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 e) { dc.ChangeConflicts.ResolveAll(RefreshMode.KeepCurrentValues); // last -in - wins dc.SubmitChanges(); } }
public void alterarConta(Conta c) { DataContext dc = new DataContext(@"Data Source=MIRANDA-LAPTOP\SQL2012DEINST1;Initial Catalog=ASI;Integrated Security=true");//TODO: CONFIGURATION FILE! 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(); } }