I will soon be deciding on a project for my university course and I had one in mind which is going to be a windows tablet application, using the UWP tools in Visual Studio, as I want to develop skills in C# and the Mobile area.
However I will need to have a database behind my application to submit and retrieve data from. Is this a relatively "simple" and common task to do? I'm not looking for easy, I just want something that I can accomplish though without worrying too much over the basics.
My original thought was to have a database on my PC and then host it for my tablet to connect too, but that would require constant internet connection and for my PC to be hosting. After having done a little bit of research I came across something called SQLite, which people seem to think is a good local database to put into the device.
Having no experience with mobile applications though, I was curious as to how I would develop an application on my PC, and then put it onto the Windows Tablet, both using the same database? Would I need to duplicate the database between systems? Or would I write the code up on my PC and then test it on my Tablet?
Again this is an area i'm still new to, database 'hosting' and mobile applications. Maybe i'm just over thinking things, but just by asking the question I can already tell I sound clueless. My experience has been with small WPF applications, Console Applications and Websites.
I will need to have a database behind my application to submit and retrieve data from. Is this a relatively "simple" and common task to do?
I think the answer is yes. As you mentioned, SQLite is a good local database for you to use. Since there are guidance, samples, teach videos for SQlite with UWP, it should be simple and common task for you to do.
I was curious as to how I would develop an application on my PC, and then put it onto the Windows Tablet,
For this you need to Get started with Windows apps. After you finished developing the app on the PC, you can publish to windows store or Sideload your app package, then you can install the app on your tablet from store or through side loaded package.
Would I need to duplicate the database between systems?
The SQlite database is actually a database file with .db or other suffix saved on the local device. Whether need duplicate depend on where you put the database file on. Since UWP app is sandbox and have limitations for access the folder on the device. By default, all apps can access the following two locations, Application install directory and Application data locations. If you put the database file on Application install directory, once you install the app on one device, the database will exist on the install directory and you don't need copy. But this directory is read only means that if your database don't need update and read only you can use. For another location,Application data location there are LocalFolder,RoamingFolder and TemporaryFolder. If you put the database on LocalFolder it cannot be roamed and you need to manually copy or user a cloud server helper you save it for roaming.If you put the database on RoamingFolder it can roam pay attention it has some restrictions. More details please reference File access permissions. In my option, SQLite is a local database, which is using only for local data will be better, I don't recommend you to use it for roaming. If you need a roaming data base, a database on cloud or server side will be much better.
Having no experience with mobile applications though, I was curious as to how I would develop an application on my PC, and then put it onto the Windows Tablet, both using the same database?
You should get start from this document Intro to the Universal Windows Platform. I believe you'r familiar with C# language, you can use C# to develop UWP apps.
As you mentioned, you could use sqlite as local database in your app. You could use LiveSDk's APIs to synchronous database when you switch from PC to tablet.
Here's a sqlite sample in uwp for your reference.
The OneDrive Photo Browser sample shows you how to get data from cloud, it would be helpful to you.
Related
I am developing an UWP application (Windows phone 10) and I have a SQLite database in a shared folder in a PC in my LAN. I would like to know if I can use this database in the windows phone app, like I do with my WPF application, that I can set the path of the database and I can use it from any computer in my lan.
Thanks.
Real Path:
\\192.168.1.102\Database\MyDB.db3
USE THIS Connection String:
Data Source='//192.168.1.102/Database/MyDB.db3';Version=3
cnStr.Replace("\", "/") in windows
Short answer:
Yes you can however you will need to be careful about the journaling mode you choose for example WAL does not work over a network file system.
Long answer:
If you see yourself in a situation where many clients/programs need to access a common database over a network you should consider a client/server database or provide an API of some sort that would sequentially persist the client's data to the SQLite DB.
For more info see Appropriate Uses of SQLite
As much I remember, it is not recommended by the developer, since file locking is very restricted in such settings (using networked file systems).
From the FAQ:
You should avoid putting SQLite database files on NFS if multiple processes might try to access the file at the same time. On Windows, Microsoft's documentation says that locking may not work under FAT filesystems if you are not running the Share.exe daemon. People who have a lot of experience with Windows tell me that file locking of network files is very buggy and is not dependable. If what they say is true, sharing an SQLite database between two or more Windows machines might cause unexpected problems.
But, if you intend to use it only from one process at a time (no concurrency involved) it should be fine.
You can't just arbitrarily open a file from a UWP app, you need to use the RuntimeBroker to handle it, and the only mechanism that can talk to RuntimeBroker is the StorageFile API, which in turn knows nothing of shared folders in a LAN environment.
To access a shared database (SQLite or otherwise), your best option is to host it on some form of server, and build an API to interface to it (be it SOAP, REST, etc). You could still use a local cache on each client for disconnected usage, but you would need to handle the replication yourself.
cnStr.Replace("\", "/") in windows
This works great!
Im am trying to connect a local mysql database which runs on xampp with a Universal Windows Platform (UWP) Application. I couldn't find any examples or tutorials on how to archieve this. In one article i have read that this isn't even possible and only sqlite is supported. Is this true?
I have to do a work for school and one criteria is, that it must have a relational database and another is to support multi-user functionality.
I dont know if it is not possible or am I just to blind to find Informations? Sometimes it seems really hard to get to informations to windows app development.
Did someone make experiences with connecting relational databases to UWP-Apps?
UWP app can connect to any server based database behind a web service. Per my experience, Windows Store app can directly connect to MySQL. Check this. I didn't have a chance to try it on win 10 UWP.
Sqlite is the database if you want to deploy a database to the device along with your UWP app.
We will soon have a respectable pool of apps available for our company's employees, we have both flavors: iOs and Android. Those apps have tremendous value for our production and sales teams but are worthless outside the company.
My boss is asking me to develop a server program from which our local mobile users can discover, download and install those apps quick and easy, very much like the App Store and Play Store, but everything inside our local network. I'm not sure if this software is even possible...
Are App Store and Play Store the only possible sources of mobile apps?... If so, which alternatives do I have for this project? If not, please point me in the right direction.
You may want to look into the Enterprise program for iOS:
https://developer.apple.com/programs/ios/enterprise/
Another alternative is signing and sideloading with using MacBuildServer. See these for more information:
http://ios.wonderhowto.com/how-to/sideload-install-open-source-ios-apps-your-iphone-using-macbuildserver-without-jailbreaking-0147456/
Side loading iPhone apps to device without certificate
This isn't exactly a code question as much as it is an advice question. I currently working on a program for a small business. This program does a multitude of things from updating their local access database, edits and updates Word and Excel docs, etc. Now I have the WPF/C# based program running on a Windows 8 computer but they would like to be able to run it from multiple computers. My first instinct was to make the project again as a WPF Browser application. My questions is how would one set something like that up? Would I have to dedicate a computer with special software to handle just this program, the database, and their documents? Any Suggestions or tips would be greatly appreciated.
It doesn't have to be a WPF Browser App to run on multiple PCs. I suggest using Click Once deployment, where all users automatically get the latest version from a shared folder on an office server or just one of the other PCs in the office.
If they want all of these instances of your application to connect to a common data source or sources, then you will need one computer that hosts the server application and its database (you'll now have 2 projects: the server application, which might run as a Windows Service and have no UI, and the client application, which is the WPF app).
This computer be an existing Windows server in the office or it can even be just one of the PCs in the office, but that PC must be kept on for others to use the app and if anyone reboots it in the middle of the day others could lose some of the data they were updating.
Fundamentally, you need to alter the WPF application so that it fetches and sends its data from/to the "server," most likely using WCF services.
It is a lot to digest, but in incremental steps you can get there. The biggest hurdle will be getting your first successful WCF communication between server and client. Once you cross that threshold you'll be well on your way!
I'm a C# noob and i want to ask if it's possible for this kind of scenario:
I have a windows form app in C#, is it possible i will only install it in 1 computer(as a server) and it can be accessible from all the computers within the network? If it's possible can you please help me what i need to do, any reference/books/tutorials?
I already googled this but i think i can't find the correct 'search word' that's why i didn't get the desired search result.
Yes it is possible. Put the C# executable in a network UNC Path, and you can access it if you create a link on the destination desktops. XP SP 2 and higher by default can run it. If it has .NET 3.0 or 3.5 or 4.0 framework you may need to install the Runtimes for those frameworks, but .NET 2.0 should be fine with XPsp2. All the frameworks are downloadable from Microsoft's site.
Is this a database driven app or just a straight up stand alone?
You don't need any books, it should work just fine. But provide as many details as you can so we can steer you in the right direction.
You may have to do a large code overhaul to do this. Could you simply install it on one computer and remote login to that computer and access it?
You see the thing about network-accessed programs is that they have two parts--a client and a server. It sounds like you just have one piece. You would need to write a program that is a windows form and install it on all the machines. You would then need to write your server code that receives the data from the client over the network.
You would need to know about socket programming. Here is a book introductory tutorial of C# and sockets.
http://www.codeproject.com/KB/IP/socketsincsharp.aspx
I'm not 100% sure what you're asking, but hopefully this covers it. If not, please edit your question to be more specific.
You can generally run a WinForms application from a shared network drive/folder by copying the executable to that drive (and making sure that all users have appropriate access to that network location).
If you use an automatic installer, it should be possible to select a network share as the place to install the software. Automatic installers tend to also put things in the local registry (e.g. create menu items for the program, which go on the local computer always). In that scenario, you would want to create an installer that creates appropriate shortcuts/menu items on the local computer that point to the pre-installed executable on the network share.
You need to take care that the windows forms application doesn't write data to the network share, or if it does, that it does so in a manner consistent with multiple users accessing that data (in other words, keep in mind that all of your users will share that location).
Put it in a shared folder and access either by UNC path or map a drive to that location. You could also map the drive for all users with group policy.
Alternatively you could wrap your app into an MSI and install it via group policy?
Hope this helps :)
You should use a layered approach to your software design. Create a website to give users access to the application from multiple locations. Then create a service layer to give the website access to the desktop functionality that you require. WCF is a good service layer as it allows consumption through HTTP.