| | |
Problems with transaction in SQL Server Mobile
Please support our C# advertiser: $4.95 a Month - ASP.NET Web Hosting – Click Here!
![]() |
•
•
Join Date: Jan 2009
Posts: 2
Reputation:
Solved Threads: 0
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 ?
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 ??
}
} 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..
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
B.Sc Computer Science, Helwan University
Technical blog | http://ramymahrous.wordpress.com
LinkedIn | http://www.linkedin.com/in/ramymahrous
![]() |
Other Threads in the C# Forum
- Previous Thread: How to merge two text files
- Next Thread: help with compiler command
| Thread Tools | Search this Thread |
.net access algorithm angle array asp.net bitmap box broadcast c# capturing check checkbox client combobox control conversion csharp database databasesearch datagrid datagridview dataset datetime dbconnection degrees delegate design development disappear draganddrop drawing encryption enum eventhandlers excel file firefox form format forms function gdi+ grantorrevokepermissionthroughc#.net image input install interface java libraries list loop marshalbyrefobject math monodevelop mouseclick movingimage msword mysql operator path pause photoshop php picturebox pixelinversion platform polynomial post programming properties radians regex remoting richtextbox server sleep socket sql statistics string study system.servicemodel table tcpclientchannel text textbox thread time timer update usb usercontrol validation virtualization visualbasic visualstudio wpf wpfc# xml






