ssreevidya.m 0 Light Poster

Hi,

I Need to implement transaction with two databases. I used LINQ for one database and normal connection for other. The code I used in Buiseness Layer like:

using (TransactionScope scope = new TransactionScope())
        {
            try
            {
                DataContext ObjSchool = new DataContext();
                MEMLiB ObjMemberships = new MEMLiB();
               
                ObjSchool.SCH_Students.InsertOnSubmit(ObjSCH_Student);   
                ObjSchool.SubmitChanges();
                if(ObjMembership.MEM_NO!=null)
                    ObjMemberships.Fn_Insert_Membership(ObjMembership);
                scope.Complete();
                return true;
            }
              
            catch (Exception Ex)
            {
                string StrError = Ex.Message;
                return false;
            }
        }

but, even if some exeptions in second insertion , first insertion occured. How can i fix this problem.

Thanks in advance,

Sreevidya

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.