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
Raghvendr Singh
NA
117
127.8k
Transaction
Jan 19 2011 4:31 AM
Hi,
I am worried about these lines of code:
SqlTransaction
trns = conn.BeginTransaction(
"tras1"
);
cmd =
new
SqlCommand
(
"insert into E_Deatil values('Ramesh_roll',50,'address1','address2')"
,conn);
cmd.Transaction = trns;
cmd.ExecuteNonQuery();
In the above code one can that I did not write any code to committed transaction.
Here is my two cases I run code.
Case1:
When I execute the above code from Visual Studio then a transaction runs mean while if I execute a sql query select * from
E_Deatil
in query analyzer then query is unable to retrieve data from database table because of there is already running a transaction from asp.net by the code.
As soon as I stop asp.net development server, query running in Query analyzer at once responded an I can see output in query window because I think transaction committed when I stoped asp.net development studio.
Case2:
Now I deployed this page on local host and run same code again, the same select query in query analyzer found same result that query in query analyzer does not respond due to transaction. Here, now I closed page or stopped running web site from IIS still query in query analyzer did not responds.
Why?
My anothere Question is that what is happining in first case when I stop asp.net development studio?If transaction being automatically committed? if it is then why and how because there is not any code to committe trans?
Reply
Answers (
3
)
create column in checkboxlist
Rating to article after Login