问题
I'm totally new to the windows phone 8.1 app development.
I'm trying to develop a simple app with a database using visual studio 2013. It is not a silverlight app.
my app just have a text field and a button.And i have a MySQL database in a local server(WAMP).
I need to get a input from the text field and store it in the database.
First thing that I want to know is it possible to do?
If it is possible I would be very grateful if you could provide a step by step guide or a link where i can learn about this.
If it is not possible what are the other ways that I can try to store my input in a database?
回答1:
Local storage
I'm guessing you're looking for a way to store structured data locally on the phone. AFAIK, MySQL is not supported on Windows Phone (MySQL is big, runs as a server, and it wouldn't be possible or practical to "install" it onto a phone). Instead what Microsoft endorses is to use SQLite. You'll first need to download the SQLite library as a Visual Studio extension. Then you'll need to install something like SQLitePCL (from NuGet) which essentially wraps the native SQLite library so that it is accessible from .NET languages. Make sure you add both references to your project. SQLite stores a database as a file that you can put in the local storage for your app.
Remote storage
I'm not sure if it's directly possible to connect to a remove MySQL server from a WP app. Usually you'd access a remote database through a webserver that exposes an API for you to use (e.g. a REST API). You can then send data to the webserver via a HTTP POST request, and then your webserver will store the data in the database. This is a big topic, and involves knowledge of server-side programming such as ASP.NET, Ruby on Rails, Django, PHP, etc. This topic is too broad for me to give you specifics on how to do this. See this answer.
来源:https://stackoverflow.com/questions/27872666/windows-phone-8-1-app-connect-with-a-database