1

I am using SQLite wrapper provided by http://sqlite.phxsoftware.com in VS2010

Here is the code that I am using

static void Main(string[] args)
    {

       INFO inf =  INFO.CreateINFO("test5", 123);
       TestDBEntities3 entity = new TestDBEntities3();
       entity.Connection.Open();
       entity.Connection.BeginTransaction();
       var result = from i in entity.INFOes
                    where i.Name.Equals(inf.Name)
                    select i;
       if (result.Count() == 0)
           entity.AddToINFOes(inf);
       entity.SaveChanges(true);
       entity.Connection.Close();
    }

When I execute the code data do not persist to the database. I am checking the right database mentioned in the connection string of App.config file.

Also I can re run the query without changing the primarykey data and no primary key conflict occurs.

But during the debug at line

entity.Connection.Close();

'entity' has the new created record in it but does not save.

Thanks

1
  • I removed the line entity.Connection.BeginTransaction(); and works fine now. Commented Jul 13, 2011 at 22:10

1 Answer 1

2

You started transaction manually so you also have to commit it ...

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.