473,800 Members | 2,227 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Multithreaded Database access with C# on an Sql2005 and TransactionScop e class (Bug or did I some mistake?)

Hello,

First of all english is not my natural language so please fogive me some bad
mistakes in gramatic and use of some vocables :).

I have a great problem here. Well I will not use it anymore but I want to
know why it is as it is ^^. I tried with .NET3.0 but I think it will be the
same with 2.0 and 3.5.
MSDTC is configured and working.

On the SQL2005-Server I created a Table Test (bigint, varchar(20)) filled
with
1, 'Test1'
2, 'Test2'
3, 'Test3'
4, 'Test4'
5, 'Test5'
6, 'Test6'

Execution the following Code works 1 of 20 Times (the other timed the
following Exception appears). After deleten the added Lines in the table and
Execute it again you always get the Exception:
(Sorry the Exception is partitially german and I don't know the english
counterpart but must be something like "Error while upgrading the
Transaction" and "There is already an opened DataReader assigned to this
connection" )
"System.Transac tions.Transacti onAbortedExcept ion: Die Transaktion wurde
abgebrochen. ---System.Transact ions.Transactio nPromotionExcep tion: Fehler
beim Versuch, die Transaktion heraufzustufen. --->
System.Data.Sql Client.SqlExcep tion: Diesem Befehl ist bereits ein geöffneter
DataReader zugeordnet, der zuerst geschlossen werden muss.\r\n bei
System.Data.Sql Client.SqlInter nalConnectionTd s.ExecuteTransa ctionYukon(Tran sactionRequest
transactionRequ est, String transactionName , IsolationLevel iso,
SqlInternalTran saction internalTransac tion, Boolean
isDelegateContr olRequest)\r\n bei
System.Data.Sql Client.SqlInter nalConnectionTd s.ExecuteTransa ction(Transacti onRequest
transactionRequ est, String name, IsolationLevel iso, SqlInternalTran saction
internalTransac tion, Boolean isDelegateContr olRequest)\r\n bei
System.Data.Sql Client.SqlDeleg atedTransaction .Promote()\r\n --- Ende der
internen Ausnahmestapelü berwachung ---\r\n bei
System.Data.Sql Client.SqlDeleg atedTransaction .Promote()\r\n bei
System.Transact ions.Tr

ansactionStateP SPEOperation.PS PEPromote(Inter nalTransaction tx)\r\n bei
System.Transact ions.Transactio nStateDelegated Base.EnterState (InternalTransa ction
tx)\r\n --- Ende der internen Ausnahmestapelü berwachung ---\r\n bei
System.Transact ions.Transactio nStateAborted.C heckForFinished Transaction(Int ernalTransactio n
tx)\r\n bei
System.Transact ions.Transactio nStatePhase0.Pr omote(InternalT ransaction
tx)\r\n bei System.Transact ions.Transactio n.Promote()\r\n bei
System.Transact ions.Transactio nInterop.Conver tToOletxTransac tion(Transactio n
transaction)\r\ n bei
System.Transact ions.Transactio nInterop.GetExp ortCookie(Trans action
transaction, Byte[] whereabouts)\r\ n bei
System.Data.Sql Client.SqlInter nalConnection.E nlistNonNull(Tr ansaction
tx)\r\n bei System.Data.Sql Client.SqlInter nalConnection.E nlist(Transacti on
tx)\r\n bei
System.Data.Sql Client.SqlInter nalConnectionTd s.Activate(Tran saction
transaction)\r\ n bei
System.Data.Pro viderBase.DbCon nectionInternal .ActivateConnec tion(Transactio n
transaction)\r\ n

bei System.Data.Pro viderBase.DbCon nectionPool.Get Connection(DbCo nnection
owningObject)\r \n bei
System.Data.Pro viderBase.DbCon nectionFactory. GetConnection(D bConnection
owningConnectio n)\r\n bei
System.Data.Pro viderBase.DbCon nectionClosed.O penConnection(D bConnection
outerConnection , DbConnectionFac tory connectionFacto ry)\r\n bei
System.Data.Sql Client.SqlConne ction.Open()\r\ n bei
TestTransaktion .Program.worker 2(Object ar) in D:\\DATEN\\Scho ellerM\\Visual
Studio 2005\\Projects\ \TestTransaktio n\\TestTransakt ion\\Program.cs :Zeile
120.\r\n bei System.Threadin g.ThreadHelper. ThreadStart_Con text(Object
state)\r\n bei System.Threadin g.ExecutionCont ext.Run(Executi onContext
executionContex t, ContextCallback callback, Object state)\r\n bei
System.Threadin g.ThreadHelper. ThreadStart(Obj ect obj)"

Well personaly I don't belief the part with the DataReader..her e is the
code

using System;

using System.Collecti ons.Generic;

using System.Text;

using System.Data.Sql Client;

using System.Transact ions;

using System.Threadin g;

namespace TestTransaktion

{

class Program

{

static void Main(string[] args)

{

try

{

using (TransactionSco pe ts = new
TransactionScop e(TransactionSc opeOption.Requi red, TimeSpan.MaxVal ue))

{

Console.WriteLi ne("Check Transaction (RootStart): L:{0} D:{1}",
Transaction.Cur rent.Transactio nInformation.Lo calIdentifier,
Transaction.Cur rent.Transactio nInformation.Di stributedIdenti fier);

Thread worker1 = new Thread(Program. worker1);

Thread worker2 = new Thread(Program. worker2);

worker1.IsBackg round = true;

worker2.IsBackg round = true;

worker1.Start(T ransaction.Curr ent.DependentCl one(DependentCl oneOption.Block CommitUntilComp lete));

worker2.Start(T ransaction.Curr ent.DependentCl one(DependentCl oneOption.Block CommitUntilComp lete));
//ThreadPool.Queu eUserWorkItem(w orker1,
Transaction.Cur rent.DependentC lone(DependentC loneOption.Bloc kCommitUntilCom plete));

//ThreadPool.Queu eUserWorkItem(w orker2,
Transaction.Cur rent.DependentC lone(DependentC loneOption.Bloc kCommitUntilCom plete));

Console.WriteLi ne("Check Transaction (RootEnd): L:{0} D:{1}",
Transaction.Cur rent.Transactio nInformation.Lo calIdentifier,
Transaction.Cur rent.Transactio nInformation.Di stributedIdenti fier);

Console.WriteLi ne("About to complete the main thread");

ts.Complete();

}

Console.WriteLi ne("Transactio n Completed");

}

catch (Exception ex)

{

Console.WriteLi ne("Top Catch");

Console.WriteLi ne(ex.ToString( ));

}

Console.WriteLi ne("Enter <Enter>");

Console.ReadLin e();

}

static void worker1(object ar)

{

try{

DependentTransa ction dtx = (DependentTrans action)ar;

using (TransactionSco pe ts = new TransactionScop e(dtx))

{

Console.WriteLi ne("Check Transaction (Worker1Start): L:{0} D:{1}",
Transaction.Cur rent.Transactio nInformation.Lo calIdentifier,
Transaction.Cur rent.Transactio nInformation.Di stributedIdenti fier);

using (SqlConnection conn = new SqlConnection(" Data
Source=WKOEDEV0 1\\SQL2005;Init ial Catalog=WKOBASE _CLONE;Persist Security
Info=True;User ID=binreader;Pa ssword=readme20 02"))

{

conn.Open();

SqlCommand co = new SqlCommand("INS ERT INTO TEST VALUES(8, 'Test8')", conn);

co.ExecuteNonQu ery();

co = new SqlCommand("SEL ECT * FROM TEST", conn);

{

SqlDataReader r = co.ExecuteReade r();

while (r.Read())

{

Console.WriteLi ne("Reader1: {0}, {1}", r.GetInt64(0), r.GetString(1)) ;

System.Threadin g.Thread.Sleep( TimeSpan.FromSe conds(5));

}

r.Close();

}

}

Thread.Sleep(90 00);

//throw new Exception("Aufz ah!");

Console.WriteLi ne("Check Transaction (Worker1End): L:{0} D:{1}",
Transaction.Cur rent.Transactio nInformation.Lo calIdentifier,
Transaction.Cur rent.Transactio nInformation.Di stributedIdenti fier);

Console.WriteLi ne("About to complete the worker9 thread's transaction
scope");

ts.Complete();

}

Console.WriteLi ne("Completing the dependent clone");

dtx.Complete();

}

catch (Exception ex)

{

Console.WriteLi ne("Worker1 Catch");

Console.WriteLi ne(ex.ToString( ));

throw;

}

}

static void worker2(object ar)

{

try{

DependentTransa ction dtx = (DependentTrans action)ar;

using (TransactionSco pe ts = new TransactionScop e(dtx))

{

Console.WriteLi ne("Check Transaction (Worker1End): L:{0} D:{1}",
Transaction.Cur rent.Transactio nInformation.Lo calIdentifier,
Transaction.Cur rent.Transactio nInformation.Di stributedIdenti fier);

using(SqlConnec tion conn = new SqlConnection(" Data
Source=WKOEDEV0 1\\SQL2005;Init ial Catalog=WKOBASE _CLONE;Persist Security
Info=True;User ID=binreader;Pa ssword=readme20 02"))

{

conn.Open();

Thread.Sleep(Ti meSpan.FromSeco nds(10)); //<- Wait till Main Thread reaches
ts.Commit();

SqlCommand co = new SqlCommand("INS ERT INTO TEST VALUES(7, 'Test7')", conn);

co.ExecuteNonQu ery();

co = new SqlCommand("SEL ECT * FROM TEST", conn);

{

SqlDataReader r = co.ExecuteReade r();

while (r.Read())

{

Console.WriteLi ne("Reader2: {0}, {1}", r.GetInt64(0), r.GetString(1)) ;

System.Threadin g.Thread.Sleep( TimeSpan.FromSe conds(2));

}

r.Close();

}

}

Thread.Sleep(50 00);

Console.WriteLi ne("Check Transaction (Worker2End): L:{0} D:{1}",
Transaction.Cur rent.Transactio nInformation.Lo calIdentifier,
Transaction.Cur rent.Transactio nInformation.Di stributedIdenti fier);

Console.WriteLi ne("About to complete the worker2 thread's transaction
scope");

ts.Complete();

}

Console.WriteLi ne("Completing the dependent clone");

dtx.Complete();

}

catch (Exception ex)

{

Console.WriteLi ne("Worker2 Catch");

Console.WriteLi ne(ex.ToString( ));

throw;

}

}

}

}

Alternativ habe ich auch diesen Code hier versucht der eher dem enspricht
was wir Momentan verwenden. Allerdings liefert der wiederum folgende
Exception (fast immer oder eben die obere)

Alternativ I tried out the following code, that was in a locical pouint of
few a little bit more like the one I am using at the moment. This code
throws the following execption (not every time but mostly the other time the
exception I showed you earlyer was thrown) (BTW funny thing same PC same
Studio but now an english exception.)

"System.Data.Sq lClient.SqlExce ption: Distributed transaction completed.
Either enlist this session in a new transaction or the NULL transaction.\r\ n
bei System.Data.Sql Client.SqlConne ction.OnError(S qlException exception,
Boolean breakConnection )\r\n bei
System.Data.Sql Client.SqlInter nalConnection.O nError(SqlExcep tion exception,
Boolean breakConnection )\r\n bei
System.Data.Sql Client.TdsParse r.ThrowExceptio nAndWarning(Tds ParserStateObje ct
stateObj)\r\n bei System.Data.Sql Client.TdsParse r.Run(RunBehavi or
runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream,
BulkCopySimpleR esultSet bulkCopyHandler , TdsParserStateO bject stateObj)\r\n
bei System.Data.Sql Client.SqlComma nd.RunExecuteNo nQueryTds(Strin g
methodName, Boolean async)\r\n bei
System.Data.Sql Client.SqlComma nd.InternalExec uteNonQuery(DbA syncResult
result, String methodName, Boolean sendToPipe)\r\n bei
System.Data.Sql Client.SqlComma nd.ExecuteNonQu ery()\r\n bei
TestTransaktion .Program.worker 2(Object ar) in D:\\DATEN\\Scho ellerM\\Visual
St

udio 2005\\Projects\ \TestTransaktio n\\TestTransakt ion\\Program.cs :Zeile
133.\r\n bei System.Threadin g.ThreadHelper. ThreadStart_Con text(Object
state)\r\n bei System.Threadin g.ExecutionCont ext.Run(Executi onContext
executionContex t, ContextCallback callback, Object state)\r\n bei
System.Threadin g.ThreadHelper. ThreadStart(Obj ect obj)"

The Code

using System;

using System.Collecti ons.Generic;

using System.Text;

using System.Data.Sql Client;

using System.Transact ions;

using System.Threadin g;

namespace TestTransaktion

{

class Program

{

static SqlConnection conn1;

static SqlConnection conn2;

static void Main(string[] args)

{

try

{

conn1 = new SqlConnection(" Data Source=WKOEDEV0 1\\SQL2005;Init ial
Catalog=WKOBASE _CLONE;Persist Security Info=True;User
ID=binreader;Pa ssword=readme20 02");

conn2 = new SqlConnection(" Data Source=WKOEDEV0 1\\SQL2005;Init ial
Catalog=WKOBASE _CLONE;Persist Security Info=True;User
ID=binreader;Pa ssword=readme20 02");

conn1.Open();

conn2.Open();

using (TransactionSco pe ts = new
TransactionScop e(TransactionSc opeOption.Requi red, TimeSpan.MaxVal ue))

{

conn1.EnlistTra nsaction(Transa ction.Current);

conn2.EnlistTra nsaction(Transa ction.Current);

Console.WriteLi ne("Check Transaction (RootStart): L:{0} D:{1}",
Transaction.Cur rent.Transactio nInformation.Lo calIdentifier,
Transaction.Cur rent.Transactio nInformation.Di stributedIdenti fier);

Thread worker1 = new Thread(Program. worker1);

Thread worker2 = new Thread(Program. worker2);

worker1.IsBackg round = true;

worker2.IsBackg round = true;

worker1.Start(T ransaction.Curr ent.DependentCl one(DependentCl oneOption.Block CommitUntilComp lete));

worker2.Start(T ransaction.Curr ent.DependentCl one(DependentCl oneOption.Block CommitUntilComp lete));
//ThreadPool.Queu eUserWorkItem(w orker1,
Transaction.Cur rent.DependentC lone(DependentC loneOption.Bloc kCommitUntilCom plete));

//ThreadPool.Queu eUserWorkItem(w orker2,
Transaction.Cur rent.DependentC lone(DependentC loneOption.Bloc kCommitUntilCom plete));

Console.WriteLi ne("Check Transaction (RootEnd): L:{0} D:{1}",
Transaction.Cur rent.Transactio nInformation.Lo calIdentifier,
Transaction.Cur rent.Transactio nInformation.Di stributedIdenti fier);

Console.WriteLi ne("About to complete the main thread");

ts.Complete();

}

conn1.Close();

conn2.Close();

Console.WriteLi ne("Transactio n Completed");

}

catch (Exception ex)

{

Console.WriteLi ne("Top Catch");

Console.WriteLi ne(ex.ToString( ));

}

Console.WriteLi ne("Enter <Enter>");

Console.ReadLin e();

}

static void worker1(object ar)

{

try{

DependentTransa ction dtx = (DependentTrans action)ar;

using (TransactionSco pe ts = new TransactionScop e(dtx))

{

Console.WriteLi ne("Check Transaction (Worker1Start): L:{0} D:{1}",
Transaction.Cur rent.Transactio nInformation.Lo calIdentifier,
Transaction.Cur rent.Transactio nInformation.Di stributedIdenti fier);

//using (SqlConnection conn = new SqlConnection(" Data
Source=WKOEDEV0 1\\SQL2005;Init ial Catalog=WKOBASE _CLONE;Persist Security
Info=True;User ID=binreader;Pa ssword=readme20 02"))

SqlConnection conn = conn1;

{

//conn.Open();

SqlCommand co = new SqlCommand("INS ERT INTO TEST VALUES(8, 'Test8')", conn);

co.ExecuteNonQu ery();

co = new SqlCommand("SEL ECT * FROM TEST", conn);

{

SqlDataReader r = co.ExecuteReade r();

while (r.Read())

{

Console.WriteLi ne("Reader1: {0}, {1}", r.GetInt64(0), r.GetString(1)) ;

System.Threadin g.Thread.Sleep( TimeSpan.FromSe conds(5));

}

r.Close();

}

}

Thread.Sleep(90 00);

//throw new Exception("Aufz ah!");

Console.WriteLi ne("Check Transaction (Worker1End): L:{0} D:{1}",
Transaction.Cur rent.Transactio nInformation.Lo calIdentifier,
Transaction.Cur rent.Transactio nInformation.Di stributedIdenti fier);

Console.WriteLi ne("About to complete the worker9 thread's transaction
scope");

ts.Complete();

}

Console.WriteLi ne("Completing the dependent clone");

dtx.Complete();

}

catch (Exception ex)

{

Console.WriteLi ne("Worker1 Catch");

Console.WriteLi ne(ex.ToString( ));

throw;

}

}

static void worker2(object ar)

{

try{

DependentTransa ction dtx = (DependentTrans action)ar;

using (TransactionSco pe ts = new TransactionScop e(dtx))

{

Console.WriteLi ne("Check Transaction (Worker1End): L:{0} D:{1}",
Transaction.Cur rent.Transactio nInformation.Lo calIdentifier,
Transaction.Cur rent.Transactio nInformation.Di stributedIdenti fier);

//using(SqlConnec tion conn = new SqlConnection(" Data
Source=WKOEDEV0 1\\SQL2005;Init ial Catalog=WKOBASE _CLONE;Persist Security
Info=True;User ID=binreader;Pa ssword=readme20 02"))

SqlConnection conn = conn2;

{

//conn.Open();

Thread.Sleep(Ti meSpan.FromSeco nds(10)); //<- Wait till Main Thread reaches
ts.Commit();

SqlCommand co = new SqlCommand("INS ERT INTO TEST VALUES(7, 'Test7')", conn);

co.ExecuteNonQu ery();

co = new SqlCommand("SEL ECT * FROM TEST", conn);

{

SqlDataReader r = co.ExecuteReade r();

while (r.Read())

{

Console.WriteLi ne("Reader2: {0}, {1}", r.GetInt64(0), r.GetString(1)) ;

System.Threadin g.Thread.Sleep( TimeSpan.FromSe conds(2));

}

r.Close();

}

}

Thread.Sleep(50 00);

Console.WriteLi ne("Check Transaction (Worker2End): L:{0} D:{1}",
Transaction.Cur rent.Transactio nInformation.Lo calIdentifier,
Transaction.Cur rent.Transactio nInformation.Di stributedIdenti fier);

Console.WriteLi ne("About to complete the worker2 thread's transaction
scope");

ts.Complete();

}

Console.WriteLi ne("Completing the dependent clone");

dtx.Complete();

}

catch (Exception ex)

{

Console.WriteLi ne("Worker2 Catch");

Console.WriteLi ne(ex.ToString( ));

throw;

}

}

}

}

I have no Idea why nothig there is working like I would expected it.

Is there an working method to access an database with multible Threads or
should I bury that idea?

Examples of working Templates are wery welcome.

With the request for help

Michael Schöller
Jun 27 '08 #1
3 2898
Is there a reason why you have one scope for two threads?

--
Sheng Jiang
Microsoft MVP in VC++
"Michael Schöller" <mi************ ***@inhouse.wko .atwrote in message
news:Oh******** *****@TK2MSFTNG P06.phx.gbl...
Hello,

First of all english is not my natural language so please fogive me some
bad
mistakes in gramatic and use of some vocables :).

I have a great problem here. Well I will not use it anymore but I want to
know why it is as it is ^^. I tried with .NET3.0 but I think it will be
the
same with 2.0 and 3.5.
MSDTC is configured and working.

On the SQL2005-Server I created a Table Test (bigint, varchar(20)) filled
with
1, 'Test1'
2, 'Test2'
3, 'Test3'
4, 'Test4'
5, 'Test5'
6, 'Test6'

Execution the following Code works 1 of 20 Times (the other timed the
following Exception appears). After deleten the added Lines in the table
and
Execute it again you always get the Exception:
(Sorry the Exception is partitially german and I don't know the english
counterpart but must be something like "Error while upgrading the
Transaction" and "There is already an opened DataReader assigned to this
connection" )
"System.Transac tions.Transacti onAbortedExcept ion: Die Transaktion wurde
abgebrochen. ---System.Transact ions.Transactio nPromotionExcep tion:
Fehler
beim Versuch, die Transaktion heraufzustufen. --->
System.Data.Sql Client.SqlExcep tion: Diesem Befehl ist bereits ein
geöffneter
DataReader zugeordnet, der zuerst geschlossen werden muss.\r\n bei
System.Data.Sql Client.SqlInter nalConnectionTd s.ExecuteTransa ctionYukon(Tran s
actionRequest
transactionRequ est, String transactionName , IsolationLevel iso,
SqlInternalTran saction internalTransac tion, Boolean
isDelegateContr olRequest)\r\n bei
System.Data.Sql Client.SqlInter nalConnectionTd s.ExecuteTransa ction(Transacti o
nRequest
transactionRequ est, String name, IsolationLevel iso,
SqlInternalTran saction
internalTransac tion, Boolean isDelegateContr olRequest)\r\n bei
System.Data.Sql Client.SqlDeleg atedTransaction .Promote()\r\n --- Ende der
internen Ausnahmestapelü berwachung ---\r\n bei
System.Data.Sql Client.SqlDeleg atedTransaction .Promote()\r\n bei
System.Transact ions.Tr

ansactionStateP SPEOperation.PS PEPromote(Inter nalTransaction tx)\r\n bei
System.Transact ions.Transactio nStateDelegated Base.EnterState (InternalTransa c
tion
tx)\r\n --- Ende der internen Ausnahmestapelü berwachung ---\r\n bei
System.Transact ions.Transactio nStateAborted.C heckForFinished Transaction(Int e
rnalTransaction
tx)\r\n bei
System.Transact ions.Transactio nStatePhase0.Pr omote(InternalT ransaction
tx)\r\n bei System.Transact ions.Transactio n.Promote()\r\n bei
System.Transact ions.Transactio nInterop.Conver tToOletxTransac tion(Transactio n
transaction)\r\ n bei
System.Transact ions.Transactio nInterop.GetExp ortCookie(Trans action
transaction, Byte[] whereabouts)\r\ n bei
System.Data.Sql Client.SqlInter nalConnection.E nlistNonNull(Tr ansaction
tx)\r\n bei System.Data.Sql Client.SqlInter nalConnection.E nlist(Transacti on
tx)\r\n bei
System.Data.Sql Client.SqlInter nalConnectionTd s.Activate(Tran saction
transaction)\r\ n bei
System.Data.Pro viderBase.DbCon nectionInternal .ActivateConnec tion(Transactio n
transaction)\r\ n

bei System.Data.Pro viderBase.DbCon nectionPool.Get Connection(DbCo nnection
owningObject)\r \n bei
System.Data.Pro viderBase.DbCon nectionFactory. GetConnection(D bConnection
owningConnectio n)\r\n bei
System.Data.Pro viderBase.DbCon nectionClosed.O penConnection(D bConnection
outerConnection , DbConnectionFac tory connectionFacto ry)\r\n bei
System.Data.Sql Client.SqlConne ction.Open()\r\ n bei
TestTransaktion .Program.worker 2(Object ar) in
D:\\DATEN\\Scho ellerM\\Visual
Studio 2005\\Projects\ \TestTransaktio n\\TestTransakt ion\\Program.cs :Zeile
120.\r\n bei System.Threadin g.ThreadHelper. ThreadStart_Con text(Object
state)\r\n bei System.Threadin g.ExecutionCont ext.Run(Executi onContext
executionContex t, ContextCallback callback, Object state)\r\n bei
System.Threadin g.ThreadHelper. ThreadStart(Obj ect obj)"

Well personaly I don't belief the part with the DataReader..her e is the
code

using System;

using System.Collecti ons.Generic;

using System.Text;

using System.Data.Sql Client;

using System.Transact ions;

using System.Threadin g;

namespace TestTransaktion

{

class Program

{

static void Main(string[] args)

{

try

{

using (TransactionSco pe ts = new
TransactionScop e(TransactionSc opeOption.Requi red, TimeSpan.MaxVal ue))

{

Console.WriteLi ne("Check Transaction (RootStart): L:{0} D:{1}",
Transaction.Cur rent.Transactio nInformation.Lo calIdentifier,
Transaction.Cur rent.Transactio nInformation.Di stributedIdenti fier);

Thread worker1 = new Thread(Program. worker1);

Thread worker2 = new Thread(Program. worker2);

worker1.IsBackg round = true;

worker2.IsBackg round = true;

worker1.Start(T ransaction.Curr ent.DependentCl one(DependentCl oneOption.Block C
ommitUntilCompl ete));
>
worker2.Start(T ransaction.Curr ent.DependentCl one(DependentCl oneOption.Block C
ommitUntilCompl ete));
>

//ThreadPool.Queu eUserWorkItem(w orker1,
Transaction.Cur rent.DependentC lone(DependentC loneOption.Bloc kCommitUntilCom p
lete));
>
//ThreadPool.Queu eUserWorkItem(w orker2,
Transaction.Cur rent.DependentC lone(DependentC loneOption.Bloc kCommitUntilCom p
lete));
>
Console.WriteLi ne("Check Transaction (RootEnd): L:{0} D:{1}",
Transaction.Cur rent.Transactio nInformation.Lo calIdentifier,
Transaction.Cur rent.Transactio nInformation.Di stributedIdenti fier);

Console.WriteLi ne("About to complete the main thread");

ts.Complete();

}

Console.WriteLi ne("Transactio n Completed");

}

catch (Exception ex)

{

Console.WriteLi ne("Top Catch");

Console.WriteLi ne(ex.ToString( ));

}

Console.WriteLi ne("Enter <Enter>");

Console.ReadLin e();

}

static void worker1(object ar)

{

try{

DependentTransa ction dtx = (DependentTrans action)ar;

using (TransactionSco pe ts = new TransactionScop e(dtx))

{

Console.WriteLi ne("Check Transaction (Worker1Start): L:{0} D:{1}",
Transaction.Cur rent.Transactio nInformation.Lo calIdentifier,
Transaction.Cur rent.Transactio nInformation.Di stributedIdenti fier);

using (SqlConnection conn = new SqlConnection(" Data
Source=WKOEDEV0 1\\SQL2005;Init ial Catalog=WKOBASE _CLONE;Persist Security
Info=True;User ID=binreader;Pa ssword=readme20 02"))

{

conn.Open();

SqlCommand co = new SqlCommand("INS ERT INTO TEST VALUES(8, 'Test8')",
conn);
>
co.ExecuteNonQu ery();

co = new SqlCommand("SEL ECT * FROM TEST", conn);

{

SqlDataReader r = co.ExecuteReade r();

while (r.Read())

{

Console.WriteLi ne("Reader1: {0}, {1}", r.GetInt64(0), r.GetString(1)) ;

System.Threadin g.Thread.Sleep( TimeSpan.FromSe conds(5));

}

r.Close();

}

}

Thread.Sleep(90 00);

//throw new Exception("Aufz ah!");

Console.WriteLi ne("Check Transaction (Worker1End): L:{0} D:{1}",
Transaction.Cur rent.Transactio nInformation.Lo calIdentifier,
Transaction.Cur rent.Transactio nInformation.Di stributedIdenti fier);

Console.WriteLi ne("About to complete the worker9 thread's transaction
scope");

ts.Complete();

}

Console.WriteLi ne("Completing the dependent clone");

dtx.Complete();

}

catch (Exception ex)

{

Console.WriteLi ne("Worker1 Catch");

Console.WriteLi ne(ex.ToString( ));

throw;

}

}

static void worker2(object ar)

{

try{

DependentTransa ction dtx = (DependentTrans action)ar;

using (TransactionSco pe ts = new TransactionScop e(dtx))

{

Console.WriteLi ne("Check Transaction (Worker1End): L:{0} D:{1}",
Transaction.Cur rent.Transactio nInformation.Lo calIdentifier,
Transaction.Cur rent.Transactio nInformation.Di stributedIdenti fier);

using(SqlConnec tion conn = new SqlConnection(" Data
Source=WKOEDEV0 1\\SQL2005;Init ial Catalog=WKOBASE _CLONE;Persist Security
Info=True;User ID=binreader;Pa ssword=readme20 02"))

{

conn.Open();

Thread.Sleep(Ti meSpan.FromSeco nds(10)); //<- Wait till Main Thread reaches
ts.Commit();

SqlCommand co = new SqlCommand("INS ERT INTO TEST VALUES(7, 'Test7')",
conn);
>
co.ExecuteNonQu ery();

co = new SqlCommand("SEL ECT * FROM TEST", conn);

{

SqlDataReader r = co.ExecuteReade r();

while (r.Read())

{

Console.WriteLi ne("Reader2: {0}, {1}", r.GetInt64(0), r.GetString(1)) ;

System.Threadin g.Thread.Sleep( TimeSpan.FromSe conds(2));

}

r.Close();

}

}

Thread.Sleep(50 00);

Console.WriteLi ne("Check Transaction (Worker2End): L:{0} D:{1}",
Transaction.Cur rent.Transactio nInformation.Lo calIdentifier,
Transaction.Cur rent.Transactio nInformation.Di stributedIdenti fier);

Console.WriteLi ne("About to complete the worker2 thread's transaction
scope");

ts.Complete();

}

Console.WriteLi ne("Completing the dependent clone");

dtx.Complete();

}

catch (Exception ex)

{

Console.WriteLi ne("Worker2 Catch");

Console.WriteLi ne(ex.ToString( ));

throw;

}

}

}

}

Alternativ habe ich auch diesen Code hier versucht der eher dem enspricht
was wir Momentan verwenden. Allerdings liefert der wiederum folgende
Exception (fast immer oder eben die obere)

Alternativ I tried out the following code, that was in a locical pouint of
few a little bit more like the one I am using at the moment. This code
throws the following execption (not every time but mostly the other time
the
exception I showed you earlyer was thrown) (BTW funny thing same PC same
Studio but now an english exception.)

"System.Data.Sq lClient.SqlExce ption: Distributed transaction completed.
Either enlist this session in a new transaction or the NULL
transaction.\r\ n
bei System.Data.Sql Client.SqlConne ction.OnError(S qlException exception,
Boolean breakConnection )\r\n bei
System.Data.Sql Client.SqlInter nalConnection.O nError(SqlExcep tion
exception,
Boolean breakConnection )\r\n bei
System.Data.Sql Client.TdsParse r.ThrowExceptio nAndWarning(Tds ParserStateObje c
t
stateObj)\r\n bei System.Data.Sql Client.TdsParse r.Run(RunBehavi or
runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream,
BulkCopySimpleR esultSet bulkCopyHandler , TdsParserStateO bject
stateObj)\r\n
bei System.Data.Sql Client.SqlComma nd.RunExecuteNo nQueryTds(Strin g
methodName, Boolean async)\r\n bei
System.Data.Sql Client.SqlComma nd.InternalExec uteNonQuery(DbA syncResult
result, String methodName, Boolean sendToPipe)\r\n bei
System.Data.Sql Client.SqlComma nd.ExecuteNonQu ery()\r\n bei
TestTransaktion .Program.worker 2(Object ar) in
D:\\DATEN\\Scho ellerM\\Visual
St

udio 2005\\Projects\ \TestTransaktio n\\TestTransakt ion\\Program.cs :Zeile
133.\r\n bei System.Threadin g.ThreadHelper. ThreadStart_Con text(Object
state)\r\n bei System.Threadin g.ExecutionCont ext.Run(Executi onContext
executionContex t, ContextCallback callback, Object state)\r\n bei
System.Threadin g.ThreadHelper. ThreadStart(Obj ect obj)"

The Code

using System;

using System.Collecti ons.Generic;

using System.Text;

using System.Data.Sql Client;

using System.Transact ions;

using System.Threadin g;

namespace TestTransaktion

{

class Program

{

static SqlConnection conn1;

static SqlConnection conn2;

static void Main(string[] args)

{

try

{

conn1 = new SqlConnection(" Data Source=WKOEDEV0 1\\SQL2005;Init ial
Catalog=WKOBASE _CLONE;Persist Security Info=True;User
ID=binreader;Pa ssword=readme20 02");

conn2 = new SqlConnection(" Data Source=WKOEDEV0 1\\SQL2005;Init ial
Catalog=WKOBASE _CLONE;Persist Security Info=True;User
ID=binreader;Pa ssword=readme20 02");

conn1.Open();

conn2.Open();

using (TransactionSco pe ts = new
TransactionScop e(TransactionSc opeOption.Requi red, TimeSpan.MaxVal ue))

{

conn1.EnlistTra nsaction(Transa ction.Current);

conn2.EnlistTra nsaction(Transa ction.Current);

Console.WriteLi ne("Check Transaction (RootStart): L:{0} D:{1}",
Transaction.Cur rent.Transactio nInformation.Lo calIdentifier,
Transaction.Cur rent.Transactio nInformation.Di stributedIdenti fier);

Thread worker1 = new Thread(Program. worker1);

Thread worker2 = new Thread(Program. worker2);

worker1.IsBackg round = true;

worker2.IsBackg round = true;

worker1.Start(T ransaction.Curr ent.DependentCl one(DependentCl oneOption.Block C
ommitUntilCompl ete));
>
worker2.Start(T ransaction.Curr ent.DependentCl one(DependentCl oneOption.Block C
ommitUntilCompl ete));
>

//ThreadPool.Queu eUserWorkItem(w orker1,
Transaction.Cur rent.DependentC lone(DependentC loneOption.Bloc kCommitUntilCom p
lete));
>
//ThreadPool.Queu eUserWorkItem(w orker2,
Transaction.Cur rent.DependentC lone(DependentC loneOption.Bloc kCommitUntilCom p
lete));
>
Console.WriteLi ne("Check Transaction (RootEnd): L:{0} D:{1}",
Transaction.Cur rent.Transactio nInformation.Lo calIdentifier,
Transaction.Cur rent.Transactio nInformation.Di stributedIdenti fier);

Console.WriteLi ne("About to complete the main thread");

ts.Complete();

}

conn1.Close();

conn2.Close();

Console.WriteLi ne("Transactio n Completed");

}

catch (Exception ex)

{

Console.WriteLi ne("Top Catch");

Console.WriteLi ne(ex.ToString( ));

}

Console.WriteLi ne("Enter <Enter>");

Console.ReadLin e();

}

static void worker1(object ar)

{

try{

DependentTransa ction dtx = (DependentTrans action)ar;

using (TransactionSco pe ts = new TransactionScop e(dtx))

{

Console.WriteLi ne("Check Transaction (Worker1Start): L:{0} D:{1}",
Transaction.Cur rent.Transactio nInformation.Lo calIdentifier,
Transaction.Cur rent.Transactio nInformation.Di stributedIdenti fier);

//using (SqlConnection conn = new SqlConnection(" Data
Source=WKOEDEV0 1\\SQL2005;Init ial Catalog=WKOBASE _CLONE;Persist Security
Info=True;User ID=binreader;Pa ssword=readme20 02"))

SqlConnection conn = conn1;

{

//conn.Open();

SqlCommand co = new SqlCommand("INS ERT INTO TEST VALUES(8, 'Test8')",
conn);
>
co.ExecuteNonQu ery();

co = new SqlCommand("SEL ECT * FROM TEST", conn);

{

SqlDataReader r = co.ExecuteReade r();

while (r.Read())

{

Console.WriteLi ne("Reader1: {0}, {1}", r.GetInt64(0), r.GetString(1)) ;

System.Threadin g.Thread.Sleep( TimeSpan.FromSe conds(5));

}

r.Close();

}

}

Thread.Sleep(90 00);

//throw new Exception("Aufz ah!");

Console.WriteLi ne("Check Transaction (Worker1End): L:{0} D:{1}",
Transaction.Cur rent.Transactio nInformation.Lo calIdentifier,
Transaction.Cur rent.Transactio nInformation.Di stributedIdenti fier);

Console.WriteLi ne("About to complete the worker9 thread's transaction
scope");

ts.Complete();

}

Console.WriteLi ne("Completing the dependent clone");

dtx.Complete();

}

catch (Exception ex)

{

Console.WriteLi ne("Worker1 Catch");

Console.WriteLi ne(ex.ToString( ));

throw;

}

}

static void worker2(object ar)

{

try{

DependentTransa ction dtx = (DependentTrans action)ar;

using (TransactionSco pe ts = new TransactionScop e(dtx))

{

Console.WriteLi ne("Check Transaction (Worker1End): L:{0} D:{1}",
Transaction.Cur rent.Transactio nInformation.Lo calIdentifier,
Transaction.Cur rent.Transactio nInformation.Di stributedIdenti fier);

//using(SqlConnec tion conn = new SqlConnection(" Data
Source=WKOEDEV0 1\\SQL2005;Init ial Catalog=WKOBASE _CLONE;Persist Security
Info=True;User ID=binreader;Pa ssword=readme20 02"))

SqlConnection conn = conn2;

{

//conn.Open();

Thread.Sleep(Ti meSpan.FromSeco nds(10)); //<- Wait till Main Thread reaches
ts.Commit();

SqlCommand co = new SqlCommand("INS ERT INTO TEST VALUES(7, 'Test7')",
conn);
>
co.ExecuteNonQu ery();

co = new SqlCommand("SEL ECT * FROM TEST", conn);

{

SqlDataReader r = co.ExecuteReade r();

while (r.Read())

{

Console.WriteLi ne("Reader2: {0}, {1}", r.GetInt64(0), r.GetString(1)) ;

System.Threadin g.Thread.Sleep( TimeSpan.FromSe conds(2));

}

r.Close();

}

}

Thread.Sleep(50 00);

Console.WriteLi ne("Check Transaction (Worker2End): L:{0} D:{1}",
Transaction.Cur rent.Transactio nInformation.Lo calIdentifier,
Transaction.Cur rent.Transactio nInformation.Di stributedIdenti fier);

Console.WriteLi ne("About to complete the worker2 thread's transaction
scope");

ts.Complete();

}

Console.WriteLi ne("Completing the dependent clone");

dtx.Complete();

}

catch (Exception ex)

{

Console.WriteLi ne("Worker2 Catch");

Console.WriteLi ne(ex.ToString( ));

throw;

}

}

}

}

I have no Idea why nothig there is working like I would expected it.

Is there an working method to access an database with multible Threads or
should I bury that idea?

Examples of working Templates are wery welcome.

With the request for help

Michael Schöller


Jun 27 '08 #2
Well yes.

This is only an Test.

The real Programm should calculate some values for Customers.

There is a method that takes an Customer-Id as parameter an calculates all
values for that Customer.

The application process customers in blocks of 50. A Transaction is opend 50
Custumervalues are calculated and the transaction is closes. (If everything
goes right). This is done by calling the method in an loop with an customer
ID one by one.

The machine where the application is running has 8 CPUs so I was thinking
about speeding up the application by calling the method 10 times as Threads
with differend Customer-Ids and do data reading and calculating of the
values parallel.

The results of the calculation are taken and written to the database.

However if an error occur the whole block has to be taken back (In worst
case all 49 correctly calculated customers. The Transactionbloc k is logged
and marked as error then).

Data reading and calculaing is done within the loop so there is already an
open transaction around that.
Jun 27 '08 #3
Ok I changed my test to reflect my needs a bit more.
I also disabled connection pooling. The effect was that my first version is
working now. (so I tried an long time test)
But this one is still not working and I don't know why...

Alway get the error (the one with the already open DataReader)
"System.Transac tions.Transacti onAbortedExcept ion: Die Transaktion wurde
abgebrochen. ---System.Transact ions.Transactio nPromotionExcep tion: Fehler
beim Versuch, die Transaktion heraufzustufen. --->
System.Data.Sql Client.SqlExcep tion: Diesem Befehl ist bereits ein geöffneter
DataReader zugeordnet, der zuerst geschlossen werden muss.\r\n bei
System.Data.Sql Client.SqlInter nalConnectionTd s.ExecuteTransa ctionYukon(Tran sactionRequest
transactionRequ est, String transactionName , IsolationLevel iso,
SqlInternalTran saction internalTransac tion, Boolean
isDelegateContr olRequest)\r\n bei
System.Data.Sql Client.SqlInter nalConnectionTd s.ExecuteTransa ction(Transacti onRequest
transactionRequ est, String name, IsolationLevel iso, SqlInternalTran saction
internalTransac tion, Boolean isDelegateContr olRequest)\r\n bei
System.Data.Sql Client.SqlDeleg atedTransaction .Promote()\r\n --- Ende der
internen Ausnahmestapelü berwachung ---\r\n bei
System.Data.Sql Client.SqlDeleg atedTransaction .Promote()\r\n bei
System.Transact ions.Tr

ansactionStateP SPEOperation.PS PEPromote(Inter nalTransaction tx)\r\n bei
System.Transact ions.Transactio nStateDelegated Base.EnterState (InternalTransa ction
tx)\r\n --- Ende der internen Ausnahmestapelü berwachung ---\r\n bei
System.Transact ions.Transactio nStateAborted.E ndCommit(Intern alTransaction
tx)\r\n bei System.Transact ions.Committabl eTransaction.Co mmit()\r\n bei
System.Transact ions.Transactio nScope.Internal Dispose()\r\n bei
System.Transact ions.Transactio nScope.Dispose( )\r\n bei
TestTransaktion .Program.Main(S tring[] args) in D:\\DATEN\\Scho ellerM\\Visual
Studio 2005\\Projects\ \TestTransaktio n\\TestTransakt ion\\Program.cs :Zeile
31.")
Always get an...
using System;

using System.Collecti ons.Generic;

using System.Text;

using System.Data.Sql Client;

using System.Transact ions;

using System.Threadin g;

namespace TestTransaktion

{

class Program

{

static void Main(string[] args)

{

try

{

using (TransactionSco pe ts = new
TransactionScop e(TransactionSc opeOption.Requi red, TimeSpan.MaxVal ue))

{

Console.WriteLi ne("Check Transaction (RootStart): L:{0} D:{1}",
Transaction.Cur rent.Transactio nInformation.Lo calIdentifier,
Transaction.Cur rent.Transactio nInformation.Di stributedIdenti fier);

for(int i = 0; i < 1000; ++i)

{

using (TransactionSco pe ts2 = new
TransactionScop e(TransactionSc opeOption.Requi resNew))

{

Console.WriteLi ne("Check Transaction (InnerStart): L:{0} D:{1}",
Transaction.Cur rent.Transactio nInformation.Lo calIdentifier,
Transaction.Cur rent.Transactio nInformation.Di stributedIdenti fier);

for (int j = 0; j < 10; ++j)

{

ThreadPool.Queu eUserWorkItem(w orker3,
Transaction.Cur rent.DependentC lone(DependentC loneOption.Bloc kCommitUntilCom plete));

}

Console.WriteLi ne("Check Transaction (InnerEnd): L:{0} D:{1}",
Transaction.Cur rent.Transactio nInformation.Lo calIdentifier,
Transaction.Cur rent.Transactio nInformation.Di stributedIdenti fier);

Console.WriteLi ne("About to complete the Innter Transaction");

ts2.Complete();

}

}

Console.WriteLi ne("Check Transaction (RootEnd): L:{0} D:{1}",
Transaction.Cur rent.Transactio nInformation.Lo calIdentifier,
Transaction.Cur rent.Transactio nInformation.Di stributedIdenti fier);

Console.WriteLi ne("About to complete the main thread");

ts.Complete();

}

Console.WriteLi ne("Transactio n Completed");

}

catch (Exception ex)

{

Console.WriteLi ne("Top Catch");

Console.WriteLi ne(ex.ToString( ));

}

Console.WriteLi ne("Enter <Enter>");

Console.ReadLin e();

}

static void worker3(object ar)

{

try

{

DependentTransa ction dtx = (DependentTrans action)ar;

using (TransactionSco pe ts = new TransactionScop e(dtx))

{

Console.WriteLi ne("Check Transaction (Worker3Start): L:{0} D:{1}",
Transaction.Cur rent.Transactio nInformation.Lo calIdentifier,
Transaction.Cur rent.Transactio nInformation.Di stributedIdenti fier);

using (SqlConnection conn = new SqlConnection(" Data
Source=WKOEDEV0 1\\SQL2005;Init ial Catalog=WKOBASE _CLONE;Persist Security
Info=True;User ID=binreader;Pa ssword=readme20 02;Pooling=fals e"))

{

conn.Open();

SqlCommand co = new SqlCommand("SEL ECT * FROM TEST", conn);

{

SqlDataReader r = co.ExecuteReade r();

while (r.Read())

{

Console.WriteLi ne("Reader3: {0}, {1}", r.GetInt64(0), r.GetString(1)) ;

System.Threadin g.Thread.Sleep( TimeSpan.FromSe conds(2));

}

r.Close();

}

}

Console.WriteLi ne("Check Transaction (Worker3End): L:{0} D:{1}",
Transaction.Cur rent.Transactio nInformation.Lo calIdentifier,
Transaction.Cur rent.Transactio nInformation.Di stributedIdenti fier);

Console.WriteLi ne("About to complete the worker3 thread's transaction
scope");

ts.Complete();

}

Console.WriteLi ne("Completing the dependent clone");

dtx.Complete();

}

catch (Exception ex)

{

Console.WriteLi ne("Worker3 Catch");

Console.WriteLi ne(ex.ToString( ));

}

}

}

}


"Michael Schöller" <mi************ ***@inhouse.wko .atschrieb im Newsbeitrag
news:ut******** ******@TK2MSFTN GP05.phx.gbl...
Well yes.

This is only an Test.

The real Programm should calculate some values for Customers.

There is a method that takes an Customer-Id as parameter an calculates all
values for that Customer.

The application process customers in blocks of 50. A Transaction is opend
50 Custumervalues are calculated and the transaction is closes. (If
everything goes right). This is done by calling the method in an loop with
an customer ID one by one.

The machine where the application is running has 8 CPUs so I was thinking
about speeding up the application by calling the method 10 times as
Threads with differend Customer-Ids and do data reading and calculating of
the values parallel.

The results of the calculation are taken and written to the database.

However if an error occur the whole block has to be taken back (In worst
case all 49 correctly calculated customers. The Transactionbloc k is logged
and marked as error then).

Data reading and calculaing is done within the loop so there is already an
open transaction around that.


Jun 27 '08 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

50
6387
by: Dan Perl | last post by:
There is something with initializing mutable class attributes that I am struggling with. I'll use an example to explain: class Father: attr1=None # this is OK attr2= # this is wrong def foo(self, data): self.attr1=data self.attr2.append(data) The initialization of attr1 is obviously OK, all instances of Father redefine it in the method foo. But the initialization of attr2 is wrong
7
2274
by: Pavils Jurjans | last post by:
Hello, I wanted to get some light in the subject. As I develop ASP.NET applications, it's necessary to understand how exactly the server- communication happens. It seems like initially application is "sleeping", and it is not loaded in the memory. Then, after very first request to the app, it is compiled (aspx files), loaded into memory, and executed. Then, a separate thread is issued to serve my page request, and it takes care for me...
6
3480
by: Stephen Carson | last post by:
I'm trying to build a Web Service that will kick off threads as logging requests come in. These threads will then log to the database. I have been able to make a simple Web Service. I have been able to get a simple multi-threaded example working. I have been used the SqlDataAdapter and DataSet classes extensively to access databases in a deployed Windows Service. But I'm getting confused how to put the pieces together. For example, I...
3
7724
by: kikapu | last post by:
Hi to all folks, i am trying to understand the use of System.Transactions in general and TransactionScope particularly. What am i allowed to do in a using statement that wraps a TransactionScope object, so this to be rollback in case of an exception or when i do not call scope.complete ?? I mean, can i set an object's variables and then un-done these sets
3
3169
by: GoogleEyeJoe | last post by:
Dear ladies and gents, I'm trying to determine whether the .NET Framework implements a means of transactional processing without the need for a database. Essentially, I'd like to enlist light-weight portable business objects within transactions so that that have the ability to roll-back if the client of the object wishes to undo any changes made. For example, if I had a, let's say for sake of simplicity, a person class that had two...
4
1760
by: news.microsoft.com | last post by:
Hi all, Assume we have two entity class. Class1: Name: House Property: ID:int Name:String Desktops:Desktop
9
1841
by: Nemisis | last post by:
Hi everyone, hope your all looking forward to xmas. I am setting up a Sql2005 database on a Windows Server, running Windows Server 2003. The database is going to be accessed via users using an ASP.Net website. My website is running the normal IUSR account. And users must login to the website, which uses Forms Authentication. I do not want to give users access directly to tables, so have created
8
10948
by: Allan Ebdrup | last post by:
I've implemented transactions in my dotNet 2.0 project using System.Transactions and TransactionScope. --- TransactionOptions options = new TransactionOptions(); options.IsolationLevel = System.Transactions.IsolationLevel.Serializable; options.Timeout = new TimeSpan(0, 5, 0); using (TransactionScope transactionScope = new TransactionScope(TransactionScopeOption.Required, options)) { DoWork();
4
5563
by: hardieca | last post by:
Hi, I'd really like to use TransactionScope within the Business Layer of my web application. A book I'm reading makes a note that it should not be used in a shared web hosting environment because the server may get re-configured. Can anyone elaborate on this? Regards, Chris
0
9551
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10505
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10275
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
10033
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
7576
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6811
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5606
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4149
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
2945
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.