[英]Creating my first Mobile App and connecting it to a database
I have to create a Windows Phone 7 app as part of a research project. 作为研究项目的一部分,我必须创建一个Windows Phone 7应用程序。 The app needs to:
该应用程序需要:
Since this is the first time I am doing any mobile programming, I am not sure what is the best approach. 由于这是我第一次进行任何移动编程,所以我不确定什么是最佳方法。 I am especially unsure of how I am going to connect to the database.
我尤其不确定如何连接数据库。 I'm not really interested in learning Silverlight, so the app should use mainly HTML5 and javascript, I also am looking into JQueryMobile.
我对学习Silverlight 并不是很感兴趣,因此该应用程序应主要使用HTML5和javascript,我也正在研究JQueryMobile。
I have already installed PhoneGap and am trying it out, but my main concern is how to connect the app to the database as I am having trouble finding the 'proper' way of doing this eg using some kind of web service or directly through javascript (read it can be done but is not recommended). 我已经安装了PhoneGap并正在尝试中,但是我主要关心的是如何将应用程序连接到数据库,因为我无法找到执行此操作的“正确”方法,例如使用某种Web服务或直接通过javascript(阅读可以完成,但不建议这样做)。 If anyone could recommend or suggest a good approach of doing this that would be great!
如果有人可以推荐或建议这样做的好方法,那就太好了!
SqlServer is only available on the phone via LinqToSql which you need to expose via a service or a DAL. SqlServer仅在通过LinqToSql的电话上可用,您需要通过服务或DAL公开。 I dont think that its possible to make calls directly from Javascript to LinqToSql on the phone.
我认为通过电话直接从Javascript到LinqToSql调用是不可能的。 If you're not set on the idea that the DB needs to be on the phone, you can just make service calls via ajax to a server and access the db that way.
如果您不希望数据库在电话上,那么您可以通过ajax向服务器进行服务调用,然后以这种方式访问数据库。 I recently did a blog post exposing a db via a WCF Data service and consuming it on the phone.
我最近写了一篇博客文章,该文章通过WCF数据服务公开了数据库,并在电话中使用了它。 It doesn't cover calling it via ajax but should help get you started.
它不涉及通过ajax调用它,但应该可以帮助您入门。
http://www.ritzcovan.com/2012/02/building-a-simple-windows-phone-apppart-4/ http://www.ritzcovan.com/2012/02/building-a-simple-windows-phone-apppart-4/
如果要在WP7数据库中存储数据,请使用PhoneGap存储API 。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.