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

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."

Related

Connecting to remote database located on web (freemysqlhosting.net‏) via visual studio c#

I have to connect my c# project to a remote database located on the web using freemysqlhosting.net‏. (note: I can use any other remote db services, but it should be free, and I need it only for about a month).
I have received the following details from freemysqlhosting.net‏:
Server: sql12.freemysqlhosting.net
Name,
Username,
Password and Port number.
After I will connect my c# project to the remote db, I plan to use entity framework in order to create the database automatically from the code.
I'm having trouble understanding how to connect my project to the remote database in a way that will later allow me to use entity framework.
Cheers :)

Do I have to install sql server on each client to use my disk top application?

I have a disk top application made by c# visual studio. My question is do I have to setup SQL server on each client to use my application? or there is another way to attach my database with my application and compress it as one and send to each client and those just extract that file and use the application correctly?
On a real scenario, your database should be placed on a remote server and the clients should only access the database through your API (that will need to support authentication or any other identity based systems).
If your application only needs to store some local information (relevant only for your client app), then you can just use LocalDB or AppSettings, depending on your data structure.
Otherwise, if your application contains more complex features, then you will need an API and a remote DB managed only by you.
To conclude, you only need to setup Sql Server once, when you want to create the design of it (tables, columns, links). The clients will only have to connect to it and pull their data. And this task can be done without installing SqlServer. This link shows you that you only need System. Data assembly to connect to a Sql Server DB.
Yes you need to instal SQL server on each machine or if you go for LocalDB then also u need to instal SQL server engine ,and you have a better option u need to buy sqlserver from AZURE (it's free for one month try if want click here AZURE)

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.

Windows programming service is unable to connect to Mysql database

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.

Connect to MS Access Database with android

I'm working on a project and I need to connect to MS Access Database. The problem is that I'm using a pretty new platform , I'm using Visual Studio 2015 Xamarin and I'm developing to android with c# (thought this platform).
I already have a project with this Database using aspx and i need to connect the android application to this Database .
I could not find any answer for it , probably cause it's new .
Thanks for helping.
The problem is not related only to Xamarin or MS Access.
Everytime you want to use the same database in different applications (in your case a website and mobile apps), it is better to create a new layer (WCF Service or REST API) in order to access the same database on the server. This is more flexible and would be the right thing in your case.
Without moving the architecture to the next Level, you will always have such problems when mixing old and new technologies together.
If you just want to finish this quickly for school and use the database only on the device, then there is no way to use the MS Access database with xamarin. I recommend using SQL lite for this and there are lots of examples for that:
https://developer.xamarin.com/recipes/android/data/databases/sqlite/
It not clear if the database is to run “local” on the android, or you just wishing to connect to some web service that holds the database?
If you needing a local database to run 100% stand-alone on the Android device, then Access is not supported. Your best bet for a local database would thus be SQLite.
Perhaps you don’t need nor want a local data store. In this case if the Access database is on the server, then you would be forced to write some kind of web service to “interact” with your Android software and the web server (this would not be a "general" interface to the database, but a set of web services that you expose on the web site - this assumes you thus have control and are able to write software and implement a web service on the web site. So in this case some kind of “direct” connection to the Access database is not possible.
You could again certainly DIRECTLY connect to a server based database like SQL server – but this would assume the web hosting allows external ODBC connections to the database (often they don’t allow this, but some do).
So not clear is if you need a local database running on the Android that can THEN connect to some web or server based system, or you simply want the android to connect via the internet to some database hosted on some server and the Android device does not have a local database at all.
Regardless of the location of MSAccess, you cannot "connect" to a non server database like Access. So the question remains as to "where" you want this database to be used, and ALSO if you need a local data store on the Android device or not.

Categories