Click here to Skip to main content
15,887,477 members
Home / Discussions / C#
   

C#

 
AnswerRe: Listbox item text Pin
Xmen Real 6-Mar-09 2:52
professional Xmen Real 6-Mar-09 2:52 
GeneralRe: Listbox item text Pin
Luc Pattyn6-Mar-09 4:23
sitebuilderLuc Pattyn6-Mar-09 4:23 
QuestionWebBrowser control issue Pin
echoDreamz5-Mar-09 23:59
echoDreamz5-Mar-09 23:59 
AnswerRe: WebBrowser control issue Pin
N a v a n e e t h6-Mar-09 0:16
N a v a n e e t h6-Mar-09 0:16 
GeneralRe: WebBrowser control issue Pin
echoDreamz6-Mar-09 0:19
echoDreamz6-Mar-09 0:19 
QuestionProblem with TableAdapters and Transactions. Pin
hdv2125-Mar-09 23:55
hdv2125-Mar-09 23:55 
AnswerRe: Problem with TableAdapters and Transactions. Pin
N a v a n e e t h6-Mar-09 0:14
N a v a n e e t h6-Mar-09 0:14 
GeneralRe: Problem with TableAdapters and Transactions. Pin
hdv2126-Mar-09 2:39
hdv2126-Mar-09 2:39 
Hi N a v a n e e t h
because my above code make our transaction promote to msdtc, the speed almost decrease and make speed lower, however i extended one of my tableAdapters and add two simple methods like this :
namespace TransactionScopeInsertSample.TestDataSetTableAdapters
{
    public partial class t5TableAdapter : System.ComponentModel.Component
    {
        public SqlConnection OpenConnection()
        {
            if (this._connection == null) this.InitConnection();
            if (this._connection.State != System.Data.ConnectionState.Open)
                this._connection.Open();
            return this._connection;
        }

        public void CloseConnection()
        {
            this._connection.Close();
        }        
    }
}


now, i use this code to make my code transactional (without promote to msdtc) :
// Using TransactionScope class with TableAdapter (Extending TableAdapter class)
using (TransactionScope ts = new TransactionScope())
{
	try
	{
		TestDataSetTableAdapters.t5TableAdapter adapterT5 = new TransactionScopeInsertSample.TestDataSetTableAdapters.t5TableAdapter();
		TestDataSetTableAdapters.t6TableAdapter adapterT6 = new TransactionScopeInsertSample.TestDataSetTableAdapters.t6TableAdapter();

		adapterT6.Connection = adapterT5.Connection;
		adapterT5.OpenConnection();

		adapterT5.Insert(int.Parse(this.textBox1.Text));
		adapterT6.Insert(int.Parse(this.textBox2.Text));

		adapterT5.CloseConnection();

		ts.Complete();
		MessageBox.Show("Values inserted!");
	}
	catch (Exception ex)
	{
		MessageBox.Show(ex.Message);
	}
}


but my question is that, is this best practice ?
GeneralRe: Problem with TableAdapters and Transactions. Pin
N a v a n e e t h6-Mar-09 17:24
N a v a n e e t h6-Mar-09 17:24 
GeneralRe: Problem with TableAdapters and Transactions. Pin
hdv2127-Mar-09 9:37
hdv2127-Mar-09 9:37 
Question[Message Deleted] Pin
Rajeev Dhiman5-Mar-09 23:45
Rajeev Dhiman5-Mar-09 23:45 
AnswerCrosspost Pin
Dave Kreskowiak6-Mar-09 4:19
mveDave Kreskowiak6-Mar-09 4:19 
Questionhow to convert a string (D10 : E 20) to a range object? Pin
abhiram_nayan5-Mar-09 22:29
abhiram_nayan5-Mar-09 22:29 
AnswerRe: how to convert a string (D10 : E 20) to a range object? Pin
abhiram_nayan5-Mar-09 22:54
abhiram_nayan5-Mar-09 22:54 
Questionreverse a string Pin
divya.simma5-Mar-09 22:15
divya.simma5-Mar-09 22:15 
AnswerRe: reverse a string Pin
N a v a n e e t h5-Mar-09 22:20
N a v a n e e t h5-Mar-09 22:20 
AnswerRe: reverse a string Pin
Mirko19805-Mar-09 22:25
Mirko19805-Mar-09 22:25 
AnswerRe: reverse a string Pin
Cracked-Down5-Mar-09 23:47
Cracked-Down5-Mar-09 23:47 
AnswerRe: reverse a string Pin
musefan6-Mar-09 2:56
musefan6-Mar-09 2:56 
QuestionHow to protect some classes? [modified] Pin
softwarejaeger5-Mar-09 21:48
softwarejaeger5-Mar-09 21:48 
AnswerRe: How to protect some classes? Pin
Dragonfly_Lee5-Mar-09 21:58
Dragonfly_Lee5-Mar-09 21:58 
AnswerRe: How to protect some classes? Pin
ABitSmart5-Mar-09 21:58
ABitSmart5-Mar-09 21:58 
AnswerRe: How to protect some classes? Pin
Vikram A Punathambekar5-Mar-09 23:05
Vikram A Punathambekar5-Mar-09 23:05 
QuestionConvert sexagesimal to decimal Pin
rumpelstielz5-Mar-09 21:44
rumpelstielz5-Mar-09 21:44 
AnswerRe: Convert sexagesimal to decimal Pin
Dragonfly_Lee5-Mar-09 22:03
Dragonfly_Lee5-Mar-09 22:03 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.