boot up

  • Thread starter Thread starter JosephB
  • Start date Start date
J

JosephB

I have a windows application that runs when the PC first boots up,
done by adding an item to the registry:

Microsoft.Win32.RegistryKey rkApp =
Microsoft.Win32.Registry.LocalMachine.OpenSubKey("SOFTWARE\\Microsoft\
\Windows\\CurrentVersion\\Run", true);
rkApp.SetValue("ApplicationName",
Application.ExecutablePath.ToString());

The first thing this application does is access an SQL Server 2005
Express Edition database on the local machine.

My problem is that occasionally the applicatiom starts before the
database has started properly and the application throws an error
because it can't see the database.

So does anyone have any idea how to fix this? Preferably by somehow
ensuring that my application only starts after the database is up and
running, but I will take all suggestions.

Thanks,

Joseph
 
You can try connecting and reconnecting if the connection fails or/and wait
for a minute or so before the application tries to connect, etc.
 
ADO makes testing connectivity one statement in one line of code and should
have been written into a try-catch-finally block in the application anyway
ainna? Its how I resolved a similar matter.

Miha Markic said:
You can try connecting and reconnecting if the connection fails or/and
wait for a minute or so before the application tries to connect, etc.

--
Miha Markic [MVP C#, INETA Country Leader for Slovenia]
RightHand .NET consulting & development www.rthand.com
Blog: http://cs.rthand.com/blogs/blog_with_righthand/

JosephB said:
I have a windows application that runs when the PC first boots up,
done by adding an item to the registry:

Microsoft.Win32.RegistryKey rkApp =
Microsoft.Win32.Registry.LocalMachine.OpenSubKey("SOFTWARE\\Microsoft\
\Windows\\CurrentVersion\\Run", true);
rkApp.SetValue("ApplicationName",
Application.ExecutablePath.ToString());

The first thing this application does is access an SQL Server 2005
Express Edition database on the local machine.

My problem is that occasionally the applicatiom starts before the
database has started properly and the application throws an error
because it can't see the database.

So does anyone have any idea how to fix this? Preferably by somehow
ensuring that my application only starts after the database is up and
running, but I will take all suggestions.

Thanks,

Joseph
 
Back
Top