TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Hemant Panchal
NA
642
627.7k
C# Transaction with store procedure
Jun 7 2015 2:32 AM
Hello all,
I need help...
I have c# code in which i have transaction I am adding row to table in transaction and updating same table's column using procedure in same transaction. But i am not getting updated rows when I am retriving from store procedure .
Example:
db.Connection.Open();
using (var dbcxtransaction = db.Connection.BeginTransaction())
{
while (odr.Read())
{
var model = new TEMP_EXCEL();
model.EXID = Convert.ToInt32(odr[0]);
model.EXCOL1 = odr[1].ToString().Trim();
model.EXCOL2 = odr[2].ToString().Trim();
db.TEMP_EXCEL.AddObject(model);
db.SaveChanges();
}
/// comment transaction.commit() I dont want to insert any data
permanently in TEMP_EXCEL
IList<TEMP_EXCEL> EXCEL = db.PROC_UPLOADMACHINES("Y").ToList();
db.SaveChanges();
}
In above example m adding rows in TEMP_EXCEL which is in transaction but I don't want to commit any data in TEMP_EXCEL
alter PROCEDURE PROC_UPLOADMACHINES
@saveFlag varchar(1)
AS
BEGIN
declare @hasError bit
update TEMP_EXCEL set EXCOL3 ='test'
select * from TEMP_EXCEL
END
GO
I am not getting updated record in
IList<TEMP_EXCEL> EXCEL = db.PROC_UPLOADMACHINES("Y").ToList();
Plz help
Reply
Answers (
2
)
How to implement watermarking in C#?
create backup in c# through win form (please read details)