New Posts New Posts RSS Feed: Set Transaction error
  FAQ FAQ  Forum Search   Calendar   Register Register  Login Login

Set Transaction error

 Post Reply Post Reply
Author
Neela View Drop Down
Newbie
Newbie


Joined: 21-May-2010
Posts: 2
Post Options Post Options   Quote Neela Quote  Post ReplyReply Direct Link To This Post Topic: Set Transaction error
    Posted: 21-May-2010 at 8:27am
Hello,
 
I am getting an error "SET TRANSACTION must be first statement of transaction." when I try to save an entity to the database. Below is the code. Please let me know in what circumstances this error would generate.
I appreciate your help. Thank you.
 
public static void SetMonth(OssMarginEntityManager em, DateTime beginDate, DateTime endDate)
        {
            var item = (from o in em.OssMarginMonths where (o.OssMarginMonthId == 1) select o).FirstOrNullEntity();
            if (item != null && item.OssMarginMonthId  >  0)
            {
                item.BeginDate = beginDate;
                item.EndDate = endDate;
                var entities = new List<Entity> { item };
                em.SaveChangesAsync(entities, SetMonthCallback, null);
            }
        }
Back to Top
ting View Drop Down
IdeaBlade
IdeaBlade
Avatar

Joined: 27-Mar-2009
Location: San Francisco
Posts: 427
Post Options Post Options   Quote ting Quote  Post ReplyReply Direct Link To This Post Posted: 21-May-2010 at 4:22pm

Sadly, I don't have quite enough to go on. Can we simplify the problem?

Set aside the decision logic. Can you write the simplest possible SL application that (a) reads an OssMarginMonth, (b) modifies it, and (c) saves it?
 
The application should do nothing else except launch, read, modify, and save.
 
If you still get the error, we'll ask that you send us something we can investigate here. Unfortunately, we can't manage an entire application. We need to work with something a bit more focused. Accordingly, we'll ask that you
 
1) Strip it down to a one table database with just OssMarginMonth
1a) Enter a few rows of sample data
2) Rebuild the sample (as just described) to talk to that toy database
3) Reproduce the error again
4) Zip it all up and send it to us
 
We regret that you're having trouble. Hope we can get this resolved quickly.
Back to Top
 Post Reply Post Reply

Forum Jump Forum Permissions View Drop Down