I have a transaction, there is a method calling in the tran. which makes insertion into a table, after that when i select the row that i have inserted, i find no result
how can i solve this problem without changing this structure or what else can i do?
Thanks in advance
using (TransactionScope scope01 = new TransactionScope(option01, span01)) {
InsertIntoTable(); // inserting a row into Foo table , insert into...executenonquery
string smcd = "select * from Foo Where XCol=@XParm";
ExecuteQuery(scmd); // This Returns no result
scope01.Complete(); }
Loading

Posted Sep 25, 2013, 9:16 AM EDT
Posted Sep 25, 2013, 12:46 AM EDT
bill brown13 reputationPosted Sep 25, 2013, 1:24 AM EDT
Posted Sep 25, 2013, 1:27 AM EDT
bill brown13 reputationPosted Sep 25, 2013, 2:59 AM EDT
Posted Sep 25, 2013, 3:05 AM EDT
http://technet.microsoft.com/en-us/library/ms173763.aspx
Specifies that statements cannot read data that has been modified but not committed by other transactions. This prevents dirty reads. Data can be changed by other transactions between individual statements within the current transaction, resulting in nonrepeatable reads or phantom data. This option is the SQL Server default.
You can't read the inserted values until the tractions is completed. So make sure, ExecuteQuerey() method is not creating a new tractions.
Please let me know, if you want to discuss it more.
bill brown13 reputationPosted Sep 25, 2013, 3:59 AM EDT
Muhammad younas164 reputationPosted Sep 25, 2013, 4:11 AM EDT
bill brown13 reputationPosted Sep 25, 2013, 4:16 AM EDT
bill brown13 reputationPosted Sep 25, 2013, 6:24 AM EDT
bill brown13 reputationPosted Sep 25, 2013, 10:03 PM EDT
Posted Sep 25, 2013, 10:05 PM EDT