|
how can I join Transaction 1 and 2?
<br />
IDbTransaction oTran1 = oConn1.BeginTransaction();<br />
obj1 = new SomeObj(oConn1);<br />
obj1.DoWork();<br />
<br />
IDbTransaction oTran2 = oConn2.BeginTransaction(); <br />
obj2 = new SomeObj(oConn2);<br />
obj2.DoWork();<br />
<br />
oTran1.Commit();<br />
oTran2.Commit();<br />
I want to do something like:
<br />
oTran2.Join(oTran1);<br />
Thanks
dev
|
|
|
|
|
You want that both transactions to be in a single transaction scope? If yes, TransactionScope[^] class will help.
|
|
|
|
|
Many thanks - is this Microsoft SQL Server specific though?
dev
|
|
|
|
|
No it will work with all providers who supports transactions. I have used it with SQL server and Oracle. Using it with Oracle requires Microsoft transaction service for oracle to be installed.
|
|
|
|
|
i am new in programming, i want to know ,how is java, is it very difficult than c# & C++?what is her ranking..how much is it difficult?
, what is client side language & databases for java?
& what is her technology like asp.net for c# for web based ?
thanking you
|
|
|
|
|
|
|
waqarnaeem2@hotmail.com wrote: is it very difficult than c#
I don't think so. But I felt JAVA is more verbose than C#.
waqarnaeem2@hotmail.com wrote: what is her ranking
|
|
|
|
|
When I was first reading about C# (circa 1999) someone said, "Isn't that the new Microsoft Java?"
|
|
|
|
|
Isn't it?
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
Java is more like C# and C# is more like Java. They share lot of common concepts. both are pure object oriented, and if you know C# it isn't difficult to learn Java. I can recommend "Head First Java" an excellent book from o'reilly to start with Java.
Sometimes Java framework like SOAP, EJB etc would scare you but once you are good with BASIC Java, Life would be much easier with them.
As far as you are concerned about the databases you can use any kind of database with Sun's ODBC drivers (just google to find them). And if you are looking to make a web application, You will need to know JSP (Java server pages, 99% like Java) and Servlets. JSP is client side and Servlet is server side scripting language.
I was a Java programmer, and I learnt C# with easy. Code project was always the best friend.
Happy learning,
Karmendra
|
|
|
|
|
Hello all,
how to configure trace listener to output trace statements to command window?
Thanks.
|
|
|
|
|
You have a custom listener in console application? If that's the case, just use Console.WriteLine.
|
|
|
|
|
its a windows application project where i want to configure tracelistener to output trace statements to command window. I have already sprinkled trace.writeline statement all over project and configured TextTraceListener, which outputs trace statements to text file.
|
|
|
|
|
As far as I know there's no 'native' support for that in framework, so I guess you should
- create a console application
- start a new process for that application
- use IPC to receive data from you trace listener
- write it to console
|
|
|
|
|
Hi Mika,
So, you mean:
1. If i configured Text trace listener to log statements to file say "TraceFile" under c:
2. The console application should watch that file ("TraceFile").
3. And if there are any changes to that File , get it and write it to console. (your way is IPC but i am thinking of FileWatcher control)
am i on right track?
Thanks.
|
|
|
|
|
Yes, you can do it that way also. When the file changes, you just have to know what lines are already written to console and write the new ones. Hopefully the FileSystemWatcher doesn't miss modifications if you're reading the file and it's modified at the same time. Also make sure that you don't lock the file while reading so that the listener is unable to write to it.
|
|
|
|
|
|
Member 2324483 wrote: am i on right track?
I don't think so. If you need the trace statements displayed in the command window, why to write it to a file and watch it? TextWriterTraceListener class has a constructor overload which takes TextWriter type. To output the trace to command window, follow the below steps.
1 - Goto project properties and change your project type to console application. This will start a command window with your form.
2 - Add the following code in the main .
static void Main() {
TextWriterTraceListener listener = new TextWriterTraceListener(Console.Out);
Trace.Listeners.Add(listener);
Application.Run(new YourStartupForm());
} You can see the Trace.WriteLine is writting to the command window.
|
|
|
|
|
Actually, i don't want to change my project type to console application. Its a product and i want to show trace output in separate window when it is enabled.
|
|
|
|
|
Hey,
im currently developing an application, one of the features of the app is that it creates
pdf files, but i want the files to be saved in a sub directory of where the application is
installed, but how do i code that?
thanks
|
|
|
|
|
You can use System.Reflection.Assembly.GetExecutingAssembly().Location . Just remove the application name part to get the directory portion and then add the subfolder you need.
|
|
|
|
|
Hallo - i hope somebody can help me....
i want to call a c-function with this code:
struct StrBox
{
char str[30];
};
struct StructBox
{
StrBox * box;
};
DLLIMPORT char * TestStrBox(StructBox *sb);
i used this c#-code to call it:
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Ansi)]
struct StrBox
{
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 30)]
public string str;
};
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Ansi)]
struct StructBox
{
[MarshalAs(UnmanagedType.LPStruct)]
public StrBox box;
};
...
StructBox b = new StructBox();
b.box.str = "Hallo Welt!!!";
string str = TestStrBox(b);
but if execute it, i get:
Ausnahme System.TypeLoadException wurde im ausgeführten Programm ausgelöst:
Cannot marshal field 'box' of type 'marshal.StructBox': Invalid managed/unmanaged type combination (this value type must be paired with Struct).
So i think it have a problem, with the struct in the struct... but the struct HAVE to be in the struct
(this is just a test, who reflects a real issue).
Hope... somebody have an idea.
Sooo. Many thx in advance
|
|
|
|
|
Hi,
your C# code has a struct in a struct, your C++ code has a struct pointer in a struct.
Luc Pattyn [Forum Guidelines] [My Articles]
- before you ask a question here, search CodeProject, then Google
- the quality and detail of your question reflects on the effectiveness of the help you are likely to get
- use the code block button (PRE tags) to preserve formatting when showing multi-line code snippets
|
|
|
|
|
Aahhh... ok!!
But how can i declare it in c#, that it is handled like a Pointer to a struct (is IntPtr the right way?)
|
|
|
|