|
Does anyone know how to synchronize two databases (prefarebly mySQL) on different servers through C#?
What confuses me most is the comparing of the two databases. Note that the two databases can have the same data due to previous synchronizations. Also, the two databases can have different data but the same primary key.
Thank you
Elaine
|
|
|
|
|
|
Hi,
I already worked with C# a while and I'd like to generate documentation. I've seen you can use '///' to add info in XML-style. So the XML can be parsed by using for example NDoc.
Is NDoc the best tool to use to generate C# Documentation? Any other software that I should use? (NDoc projet is not being update lately...)
Any advice/suggestions are welcome
Greetings,
Jens
|
|
|
|
|
I think NDoc is the best choice.
--------------------------------------------------------
My development blog
Q:What does the derived class in C# tell to it's parent?
A:All your base are belong to us!
|
|
|
|
|
I second NDoc, but as you have noticed they haven't released a binary for a while. Although there are currently working on a release for 2.0 framework features (like generics). I have a few c# 2.0 projects which could do with this.
|
|
|
|
|
Hello,
Thanks for your time to read my request for a help. I developed my windows application with C#, which has many background workers working at the same time, opening and closing sql databases, modifying sql tables etc. Now, very often I get this error message, " There is already an open DataReader associated with this Command which must be closed first.". I dont know why its happenning sometimes and sometimes not. Is that the reason one thred and another thread conflicting each other when they try to read or modify same sql database ? And sometimes, I get some weired error saying "in order to execute the sqlcommand, connection must be open. ", And I dont see any reason why connection is getting closed before that sqlcommand execution. Now I had to place if(myConn.State == ConnectionState.Close) myConn.Open() ; before every sqlcommand. Even after that I am getting same error sometimes. Can anyone please give me some clue to solve and seal this problem permanently.
Thanks and regards
emran
|
|
|
|
|
You can have any number of connections open to the database, so that is not the problem. The problem is most likely how you use the connection objects in your code. You can't share connetions between threads.
---
b { font-weight: normal; }
|
|
|
|
|
the exception you're getting is probably when executing SQLCommands using "ExecuteDataReader" and openning the datareader while another data reader is already opened in another thread.
example of creating the exception:
thread 1 executes:
SqlDataReader dr = LocalSqlCommand.ExecuteDataRead();
dr.Open();
...
in the same time thread 2 tries to execute the same symmantec:
SqlDataReader dr = LocalSqlCommand.ExecuteDataRead()
dr.Open() -> this will generate the exception...
its a .NET limitation to open only one DataReader per application !!!
a workaround:
- always close the dataReader when finished by executing: dr.Close()
- try raising a flag between threads (mutex) so they block each other while they open and close DataReaders
best regards
|
|
|
|
|
eyad al akhras wrote: its a .NET limitation to open only one DataReader per application !!!
No, not per application, but per connection. Not really a limitation, as you easily can open as many connections as you like.
---
b { font-weight: normal; }
|
|
|
|
|
Hello,
Thanks for your reply. Actually I am using same instance of sqlconnection all over my code because, when I used different instance of sqlconnection, I face another problem. If One connection made a change in the database, another connection doesn't reflect the change. It still retrieive old values from SQL unless that connection itself did not do the changes in SQL. Is there any way to synchronize all changes made by different sql connection instances ?
|
|
|
|
|
you're right Guffa, appologies for wrong contribution.
|
|
|
|
|
Hello eyad al akhras ,
Thanks a lot for the reply.
Actually in one of my thread, I have a dataGrid bounded with a daasource, so, my application is considering that databounded datagrid as an open active datareader. And at the same time another thread is executing SQL command. And sometimes, When another thread is executing SQL command, when I try to click Update (or SAve) button of a databinding navigator (for my datagridview) I get the same error saying "already datareader open.". Is there any snippet available to solve this problem either using mutext or something else. I have never used lock, mutex etc in my code, I dont know how to use those.
Thanks and regards
Emran
|
|
|
|
|
read these two article, found when searching codeProject for "Threads":
- "Synchronization Basics and Concept of Using a Synchronized Wrapper"
at http://www.codeproject.com/csharp/syncroot.asp
- and, for a Thread starter article: "Understanding Threading in .NET Framework"
at http://www.codeproject.com/csharp/threadinginnet.asp
I think you should, eventually, concentrate your efforts on wrapping the SqlCommand execution all over your code (even in the DB Navigator) to synchronize with other threads.
if you still feel stuck after reading the articles, i'll further explain.
|
|
|
|
|
How can we edit a data grid in win application (VB/C#) like we do it easily
in asp.net by property builder wizard ?
|
|
|
|
|
Can somebody please give me the example of operator overloading in C#
Thank You
Pankaj Garg
-- modified at 3:59 Sunday 23rd April, 2006
|
|
|
|
|
|
What is the meaning of unmanaged code in VB.net and C#
and what is meaning of line that we can write the unmanaged code in c# and not in vb.net
Thank You
Pankaj Garg
-- modified at 3:59 Sunday 23rd April, 2006
|
|
|
|
|
Managed code is everything that runs under the CLR. Unmanaged is everything that does not.
C# provdies this feature, VB.NET does not. It is as simple as that.
--------------------------------------------------------
My development blog
Q:What does the derived class in C# tell to it's parent?
A:All your base are belong to us!
|
|
|
|
|
If you want to use pointers in c# u have to write unsafe codes which result in unmanaged.
---
Eat Bytes Everyday
Zakaria Bin Abdur Rouf
zakaria7@gmail.com
|
|
|
|
|
Hi,
I am trying to implement a CSR(Coalition Service Registry). This is basically a registry where any service provider registers his/her service. Any service requesting user (initiator) contacts the CSR and the CSR forwards the request to the appropriate service provider and gets the result from it and forwards the result back to the initiator. I am implementing this in Visual Studio .NET C# language.
Generally in .NET to consume a web service we need to add a web reference to the client application. This leads us to use a static URL. But my implementation cannot afford doing this. So how would I approach it? To be more specific I need to implement the same functionality what "Add a Web reference" would do in .NET framework. Another issue I have is the invoking of the web service by the CSR should be transparent to the intitiator. Can anyone suggest a possible solution to this?Suggestions with a little detail of any libraries or classes existing in .NET which I could make use of is highly appreciated.
Thanks in advance,
Shobha.
|
|
|
|
|
You can change the URL of a web service dynamically.
---
b { font-weight: normal; }
|
|
|
|
|
Thanks for your reply.
I'm beginner in these web services so my question may be very silly too sometime. Yeah I came across that option of changing the URL dynamically. But in that case if I'm right the service directory and service file should it be same? A sample code would help me a lot. And after this how will my CSR invoke the service and get the result and give it back to the requested client? I'm kinda confused in this part too.
|
|
|
|
|
DotNet novice wrote: Yeah I came across that option of changing the URL dynamically. But in that case if I'm right the service directory and service file should it be same? A sample code would help me a lot.
I did this a back while, but unfortunately the code was for an application built for another company, so I can't share any of that code.
The principle however, is simply to create the object for the proxy and then change the property for the URL. I don't remember the details, but I was able to find it quite easily, and you even know what to look for.
DotNet novice wrote: And after this how will my CSR invoke the service and get the result and give it back to the requested client?
Once you changed the URL you use the proxy as normal. To get the result back to the client you just return it as usual (whether it's a web service or a web request).
---
b { font-weight: normal; }
|
|
|
|
|
I have a "test.cmh" help file that I compiled. Is there a way to restrict the use of the help file to be used only via an C# applications?. in other words, the CHM file will not run when user click on it.
|
|
|
|
|
Simply: No I don't think so unless you want to embed the help file as a resource and then extract it when you need but I'm not sure that this will work.
Another simple protection method would be to give it a different name without the .chm extension, for general users they wouldn't change the extension, but then again they probably wouldn't look for it.
Ed
|
|
|
|