Problems with transaction in SQL Server Mobile

Please support our C# advertiser: Intel Parallel Studio Home
Reply

Join Date: Jan 2009
Posts: 2
Reputation: Dav1d1 is an unknown quantity at this point 
Solved Threads: 0
Dav1d1 Dav1d1 is offline Offline
Newbie Poster

Problems with transaction in SQL Server Mobile

 
0
  #1
Jan 11th, 2009
Hello

I try pass data from a table in Firebird to SQL server Mobile. I'm using c# in vs2005, and I have problems with transactions. At the end, if I want to rollback transaction, I would like to undo changes, but in the code I show you, Changes allways saves in database.

Why doesn't rollback works ?

public class MoveData
    {
    

        private SqlCeConnection conection;
        private SqlCeTransaction trans;
        private SqlCeDataAdapter command;

        public MoveData(String path)
        {
            
            conection = new SqlCeConnection(@"Data Source=D:\MyDataBase.sdf");
            conection.Open();
        }

        public void MovingData()
        {
            
           
            //It's a empty table
	    command = new SqlCeDataAdapter("SELECT * FROM INVOICE", conection);
            DataSet dataSet = new DataSet();

            DataSet dataSet = new DataSet();
            command.Fill(dataSet, "INVOICE");
            DataTable TINVOICE = dataSet.Tables["INVOICE"];
            trans = conection.BeginTransaction();
        

            foreach (DataRow row in TINVOICEotherdatabasetable.Rows)
            {
               
                DataRow row1 = TINVOICE.NewRow();
                foreach(DataColumn column in TINVOICEotherdatabasetable.Columns)
                {
                    row1[column.ColumnName] = row[column.ColumnName];
                   
                }
                TINVOICE.Rows.Add(row1);

            }
           
               SqlCeCommandBuilder commands = new SqlCeCommandBuilder(command);
                command.Update(dataSet,"INVOICE"); //here save me changes in database
                trans.Rollback();// this Rollback doesn't work, Why ??
               
            
        }
    }
Reply With Quote Quick reply to this message  
Join Date: Oct 2008
Posts: 1,908
Reputation: ddanbe has much to be proud of ddanbe has much to be proud of ddanbe has much to be proud of ddanbe has much to be proud of ddanbe has much to be proud of ddanbe has much to be proud of ddanbe has much to be proud of ddanbe has much to be proud of ddanbe has much to be proud of 
Solved Threads: 274
ddanbe's Avatar
ddanbe ddanbe is offline Offline
Posting Virtuoso

Re: Problems with transaction in SQL Server Mobile

 
0
  #2
Jan 11th, 2009
Sorry.
Last edited by ddanbe; Jan 11th, 2009 at 2:55 pm. Reason: Wrong answer
Today is a gift, that's why it is called "The Present".
Make love, no war. Cave ab homine unius libri.
Danny
Reply With Quote Quick reply to this message  
Join Date: Aug 2006
Posts: 2,065
Reputation: Ramy Mahrous is just really nice Ramy Mahrous is just really nice Ramy Mahrous is just really nice Ramy Mahrous is just really nice 
Solved Threads: 256
Featured Poster
Ramy Mahrous's Avatar
Ramy Mahrous Ramy Mahrous is offline Offline
Postaholic

Re: Problems with transaction in SQL Server Mobile

 
0
  #3
Jan 11th, 2009
Have a look http://msdn.microsoft.com/en-us/libr...ck(VS.80).aspx
It may should be defined in IsolationLevel member... I don't know I need to help, wish for you th best..
BI Developer | LINKdotNET
B.Sc Computer Science, Helwan University
Technical blog | http://ramymahrous.wordpress.com
LinkedIn | http://www.linkedin.com/in/ramymahrous
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:



Other Threads in the C# Forum
Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC