Windows programming service is unable to connect to Mysql database - c#

I am using a windows programming in c#,the windows service which I am using as to connect mysql database to fetch the data and it has to upload the data to server.But when the services is being started in my local system, the windows service is getting started first and then Mysql database service is getting started.
In this case, it is unable to connect to mysql database, so that I have to create a dependency that mysql should start first and then windows service has to start next.
How to implement the dependency code in my program,such that the clients who are using this windows service should not effect with this problem,I have do it through code that it has to be done automatically.

You can set DelayedAutoStart = true for you System.ServiceProcess.ServiceInstaller in your Installer class.

Related

Data Sync for Universal Windows App(desktop) Sqlite

I am currently working on a windows universal app project(deskptop App), what i want to do is store data in my uwp app using sqlite database and be able to sync this data to a sql database located on azure, i went came across this online
https://blogs.msdn.microsoft.com/sync/2010/08/31/sql-server-to-sql-azure-synchronization-using-sync-framework-2-1/
but it seems applicable to sqlcompact and sql to sql on azure.
Please can any one help wiith how i can sync my uwp sqlite database with sql database on azure.Thank you
how i can sync my uwp sqlite database with sql database on azure.
You could use Azure app service. The mobile apps have the "Offline sync" feature:
You can sync dataset automatically with the back-end data, including conflict-resolution support.
For more details about "Offline sync" please reference this document.
For how to create a UWP mobile app please reference this article.
In your scenario, since you already have a SqlServer on azure, so when you are following the tutorial, after created the backend, in the step of Configure the server project, you can instead choose "Use an existing database".
After the client mobile app created successfully, then you need to Enable offline sync for your Windows app. The sample just showed how to use the SQLite as the local store. Using PushAsync method to push tables to the backend which is configured the SQL Server to meet your requirements.

SQL notification problems upon Change from local IIS to azure APP

I am trying to upgrade my application from being in a local machine (both application and SQL server) to using the combination of Azure APP and Azure SQL service. I have successfully published the code in the Azure Web App, and the Application works except from one error that keeps on comming.
"{serviceResponse:{success:false,message:"System.InvalidOperationException: When using SqlDependency without providing an options value, SqlDependency.Start() must be called prior to execution of a command added to the SqlDependency instance."
in the Application start I am indeed using the SqlDependency that works only locally. The only sort of solution I found is to use the SqlNotificationRequest, but I have not been able to make it work using it.
What corrections do I need to do in order to make the App work with my remote DB? I am using C# (.net) and SQL server 2016.

Accessing a Web Database using a Local Application

We're currently developing a desktop Application using C# and we've created a local database using MySQL.
Now are trying to create a desktop application that can access a web database but we don't know what to do.
1) Is it possible to create a desktop application that can do that just by using C#?
2) How can we convert or connect a local database to the internet?
3) What language do we need to learn?
So if I understand correctly the application needs to collect data from a web service. Not having much experience with C# tho it sounds like you need a database, web server and the client application (which you have already).
1) Is it possible to create a desktop application that can do that just by using C#?
Yes, it is. You could write a server socket program in C# and connect to it using your client application (inspiration)
2) How can we convert or connect a local database to the internet?
You could setup a MySQL server (netbeans example). Or simply connect the server socket program from above to the database (take a look at this).
3) what do language do we need to learn?
Seems like you have what you need in C# and SQL to complete the task.
My advice is to continue in the following order:
Write the Server app, so it responds with some dummy data
Modify your client app to connect to the server and successfully receive data
Once (2) is complete modify the server to connect to the database

How to access local sqlite database of android application from .NET application

I want to synchronize android app database with central sql server database.
I currently working on .NET web services,Web service should update remote android database after every 10 minutes.I am not getting exact way.how to do this? I have developed web service but getting error of unable to open database while accessing remote database.
Is it possible to update remote sqlite database from .NET webservices?
please help me.Is there any other solution?
You need to add the parameter Legacy Format=True to your connection string.
Take a look at https://www.connectionstrings.com/sqlite/ under "Using the pre 3.3x database format."

my windows service starts before the sql server service

I have a windows service written in c#, which when running connects to a sql server database.
When the service first starts it connects to the database to obtain various information for the service to run.
The service is set to automatically start if the server it is installed on is restarted.
If the service starts before the sql server service has started. My service when started obviously has an initial execption error when trying to connect to the database.
To combat this issue, if the exception occurs I have added a short delay before try to connect to the database again, I continue this n amount of times until it connects
My question is, is there any alternative solutions to what I am doing already
thanks
Make your service dependent on SQL Server, done using ‘sc’.
Using a poll, as you're doing right now is fie, and you'll still need it if your service starts after SQL Server because you can never be sure SQL Server has fully started then.

Categories