Windows Phone 8.1应用程序与数据库连接 [英] Windows phone 8.1 app connect with a database

查看:94
本文介绍了Windows Phone 8.1应用程序与数据库连接的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我对Windows Phone 8.1应用程序开发完全陌生.

I'm totally new to the windows phone 8.1 app development.

我正在尝试使用Visual Studio 2013用数据库开发一个简单的应用程序.它不是Silverlight应用程序.

I'm trying to develop a simple app with a database using visual studio 2013. It is not a silverlight app.

我的应用程序只有一个文本字段和一个按钮.我在本地服务器(WAMP)中有一个MySQL数据库.

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?

推荐答案

本地存储

我猜您正在寻找一种在电话上本地存储结构化数据的方法. AFAIK,Windows Phone不支持MySQL(MySQL很大,可以作为服务器运行,并且不可能将其安装"到手机上).相反,Microsoft认可的是使用SQLite.首先,您需要下载 SQLite库 Visual Studio扩展.然后,您需要安装 SQLitePCL 之类的东西(来自

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.

远程存储

我不确定是否可以直接从WP应用连接到已删除的MySQL服务器.通常,您会通过网络服务器访问远程数据库,该服务器公开了供您使用的API(例如REST API).然后,您可以通过HTTP POST请求将数据发送到Web服务器,然后您的Web服务器会将数据存储在数据库中.这是一个很大的主题,涉及服务器端编程的知识,例如ASP.NET,Ruby on Rails,Django,PHP等.对于我来说,这个主题太宽泛,无法为您提供具体的操作方法.参见此答案.

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.

这篇关于Windows Phone 8.1应用程序与数据库连接的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆