|
I'm not really an expert here, but I think that since Windows Services are all handled in a unique central place, there is no need to worry about the constructor/OnStart/OnStop methods. However, you have to worry about access to other resources your service might use during normal operations.
|
|
|
|
|
Thanks Dario,
Is it possible that two different instances (processes) for the same Windows service will be started and run at the same time?
regards,
George
|
|
|
|
|
George_George wrote: Is it possible that two different instances (processes) for the same Windows service will be started and run at the same time?
No, unless you create two different services that point to the same executable.
Anyway, a service can be started only once, even using command-line tools or WMI.
On the other hand, two processes do not implicitly share memory, so you would not have concurrency problems even in the case a service was started twice, except for file access I guess (remember that all the Windows API are reentrant).
|
|
|
|
|
Good answer, thanks Dario!
So, I think the conclusion is there is no need to consider concurrent issue here.
regards,
George
|
|
|
|
|
George_George wrote: So, I think the conclusion is there is no need to consider concurrent issue here.
Exactly.
|
|
|
|
|
Cool, Dario!
Question answered.
regards,
George
|
|
|
|
|
Hello Friends,
I need to import a
MSAccess Database to SQL server 2005 using C# code.
My question will be is it possible to do so?--I googled and am yet to find a satisfactory answer.So i thought i will post the question.
Also is it possible to import a txt file to MSAccess?
If yes can you guys give me any links please.
Thanking You all
|
|
|
|
|
TXT to Acess: google search for "Access import txt"
Access to SQL Server: google search for "sql server database import wizard"
If you only need to import the access database once, there's no reason to write a program to do it. If you need to import the database on a regular basis, then all you need to do is run the import wizard once, then when the wizard prompts you to "Save SSIS" package, save it as a local file. Then you can simply setup a scheduled job to run dtexec and import the database. If you need more control than that look at the SQL Data Compare tool from RedGate software www.red-gate.com[^].
Mark's blog: developMENTALmadness.blogspot.com
Funniest variable name:
lLongDong - spotted in legacy code, was used to determine how long a beep should be. - Dave Bacher
|
|
|
|
|
Thank you Mark,I will check this.
|
|
|
|
|
Hello
Can someone help me for the below problem,
I am working on a task of accessing VB6 Application's Method in c#.Net.
I dont know how to access and use methods of VB6 in asp.net.
Thanks in advance
sri
|
|
|
|
|
I guess you can add a reference as COM component. But this is not recommended. You can copy the code from VB6.0 and put it in a VB.NET project, compile and use that assembly, which will be managed code.
|
|
|
|
|
Thanks for your immediate reply.
Is there any chance to use reflection to meet my requirement?
if so, Can anyone please tell me how?
Thanks in Advance
sri
|
|
|
|
|
I think you will find you can get to some of them through the various Microsoft.VisualBasic namespaces.
|
|
|
|
|
I have three dates 1*,2*,3* ......
1* dateto = {4/9/2008 1:20:25 PM}// date time formate
range is like this
2* strdate=14-Feb-08 // string formate from datetime picker
3* enddate =14-Apr-08 // string formate from datetime picker
so now i have to check whether 1* lies between 2* and 3* or not..
can anybody suggest me what are the best ways to do...
i was trying to split the string and then compare first year then month then days
but that is going lengthy
so please help me here..
thanks in advance...
vikas da
|
|
|
|
|
The datetime picker returns a DateTime object, I thought. Just use the > operator to work out if your date is > the first and < the second.
Christian Graus
Please read this if you don't understand the answer I've given you
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
Hello everyone,
To implement a service, I think we just need to derived from ServiceBase class, and implement some event handler function, like OnStart, OnStop, etc.
As described in the sample,
http://msdn2.microsoft.com/en-us/library/system.serviceprocess.servicebase(VS.80).aspx
What is the function of method InitializeComponent? I found it never called explicitly in the class SimpleService, nor there are any document from MSDN about this method. Any ideas?
thanks in advance,
George
|
|
|
|
|
George_George wrote: InitializeComponent
This is always where auto generated code lives, you should not modify it if you can help it.
Christian Graus
Please read this if you don't understand the answer I've given you
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
Do we need to modify code for this method? Which party will invoke this method?
regards,
George
|
|
|
|
|
As Christian said, you don't need to modify it. Its just the designer code, so for example, if you drop a textBox on a form, all it's initialisations will go there such as it's size, location, name etc...
He who makes a beast out of himself gets rid of the pain of being a man
|
|
|
|
|
Thanks Phannon,
Your reply is great! I think you mean this method will be maintained by designer (for example, if we add new Timer control, designer will add initialization code for Timer control in this method).
If we want any initialization code, we should put in constructor, right?
regards,
George
|
|
|
|
|
George_George wrote: Which party will invoke this method?
As CG said, it is auto generated. In windows application, controls will be initialized and added to the container in this method. This will be called from the constructor. In service you don't need this since you are not using any components like Timer etc. If you are using components like Timer, you can make use of this method to initialize the component and add it to the components collection which is IContainer instance. This helps the application to dispose the components used when service is getting disposed.
Hope this helps
|
|
|
|
|
|
George_George wrote: Do you think my understanding here is correct?
Yes.
George_George wrote: If we want any initialization code, we should put in constructor, right?
You can put the initialization code anywhere before the instance is used.
|
|
|
|
|
Cool, N a v a n e e t h!
Question answered.
regards,
George
|
|
|
|
|
hi,
for send Tab key >>> SendKeys.Send("\t");
but i want to know, how may I send BACK TAB which we usually use in form's textbox like "SHIFT+TAB"
SendKeys.Send(?????)
Thank you in advance
|
|
|
|