Solved

Set SQL Transaction on Strongly Type TableAdapter

Posted on 2009-04-05
3
372 Views
Last Modified: 2013-12-17
Strongly typed table adapters do not expose select, insert or delete commands.  How can you attach a SQL transaction?
0
Comment
Question by:wadepart
3 Comments
 
LVL 9

Expert Comment

by:djon2003
ID: 24074485
How about :
SqlCommand myCmd = new SqlCommand();
myCmd.Connection = CURCONN;
myCmd.CommandText = "BEGIN TRANSACTION";
myCmd.ExecuteNonQuery();

Open in new window

0
 
LVL 83

Accepted Solution

by:
CodeCruiser earned 500 total points
ID: 24075158
Here is a work around
http://www.codeproject.com/KB/dotnet/transactionta.aspx

On this page
http://www.pcreview.co.uk/forums/thread-1899482.php
check out the comment from zebadiah81

You can add queries to the tableadapter. Here is a sample. Scroll a bit to see the add query example

http://weblogs.asp.net/scottgu/archive/2006/01/15/435498.aspx

0
 

Author Closing Comment

by:wadepart
ID: 31566862
Codeproject link was a good solution for creating a new class for tableadapters.  In the end went with solution from link below to create a new function using same reflection to set transaction on adapter. http://www.devnewsgroups.net/group/microsoft.public.dotnet.framework.adonet/topic61572.aspx
0

Featured Post

What is SQL Server and how does it work?

The purpose of this paper is to provide you background on SQL Server. It’s your self-study guide for learning fundamentals. It includes both the history of SQL and its technical basics. Concepts and definitions will form the solid foundation of your future DBA expertise.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article explains how to reset the password of the sa account on a Microsoft SQL Server.  The steps in this article work in SQL 2005, 2008, 2008 R2, 2012, 2014 and 2016.
Real-time is more about the business, not the technology. In day-to-day life, to make real-time decisions like buying or investing, business needs the latest information(e.g. Gold Rate/Stock Rate). Unlike traditional days, you need not wait for a fe…
Although Jacob Bernoulli (1654-1705) has been credited as the creator of "Binomial Distribution Table", Gottfried Leibniz (1646-1716) did his dissertation on the subject in 1666; Leibniz you may recall is the co-inventor of "Calculus" and beat Isaac…
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …

770 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question