-1

I want to ask about Linq. Can I discard change to database using Linq? For example, I've submit data to database, but I haven't use db.SubmitChanges(); syntax. Well, this is going to be hard to explain, so let's take a look for the example.

//the Code for insert the data to database
db.myTable.InsertOnSubmit(insert);

So, if I want to submit to database, I have to use :

db.SubmitChanges();

But, what I want to do is to discard or cancel my insert data, so when I use db.SubmitChanges(); the data will not go to the database.

I'm so sorry if this is so confusing, I'm still beginner.

Moh Rip
  • 57
  • 2
  • 8
  • If you omit `db.SubmitChanges()` It Wont be saved; create a new instance of yourcontext everything else is same as your db. – Eldho Sep 11 '18 at 06:23

1 Answers1

0

Just don't call SubmitChanges() at the end and it won't save to DB.

SushiDynamite
  • 133
  • 1
  • 4
  • 12