in my method i have the following lines:
Java |
at the linke where i call BeginTransaction() it throws Invalid Operation exception
the following video shows what is excatly happening: http://www.youtube.com/watch?v=Sc5c40WT89M
thanks
Java |
Know the answer? Post it. Somebody with the same question will find it here.
Answer a question in the forums and earn +20 SHARP for every answer.
See unanswered questions
DevSocialUpcoming · 3rd editionAI Agents ConferenceDec 1–3, 2026Live onlineFree to attend5days leftRegister
Rakesh Jha85 reputationPosted Oct 5, 2010, 8:32 PM EDT
I suppose you are missing commandtext property.
SqlConnection con = new SqlConnection(@"server=servername; database=dbname; user id=username; password=password;");
SqlCommand cmd = new SqlCommand();
cmd.CommandText = "procedure"; <---- put your procedure name here
cmd.CommandType = CommandType.StoredProcedure;
cmd.Connection = con;
SqlTransaction trn = con.BeginTransaction();
hope it will help, also you can change connection string like above given.
Gomathi PalaniswamyRank #714 · 3.3K reputationPosted Oct 5, 2010, 8:50 PM EDT
refer the below article.
http://www.dotnetspider.com/resources/4459-How-use-SqlTransaction-object-C.aspx
Sam HobbsRank #107 · 20.5K reputationPosted Oct 6, 2010, 2:19 AM EDT