Solved

Set SQL Transaction on Strongly Type TableAdapter

Posted on 2009-04-05
3
376 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

Visualize your virtual and backup environments

Create well-organized and polished visualizations of your virtual and backup environments when planning VMware vSphere, Microsoft Hyper-V or Veeam deployments. It helps you to gain better visibility and valuable business insights.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Adjust the codes 3 63
PowerShell: Adding ToGB to a script 4 72
vb.net dbnull syntax 1 55
SQL Server 2005 running VERY slowly on new hardware 22 61
Wouldn’t it be nice if you could test whether an element is contained in an array by using a Contains method just like the one available on List objects? Wouldn’t it be good if you could write code like this? (CODE) In .NET 3.5, this is possible…
Use this article to create a batch file to backup a Microsoft SQL Server database to a Windows folder.  The folder can be on the local hard drive or on a network share.  This batch file will query the SQL server to get the current date & time and wi…
Nobody understands Phishing better than an anti-spam company. That’s why we are providing Phishing Awareness Training to our customers. According to a report by Verizon, only 3% of targeted users report malicious emails to management. With compan…

734 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