从远程SQL数据库中读取数据的最佳方法,最佳应用类型? [英] Best way to read data from Remote SQL Database, best App Type?

查看:68
本文介绍了从远程SQL数据库中读取数据的最佳方法,最佳应用类型?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,

这必须是一个常见的问题(或类似于其他帖子),但我只是想要一些信息。我是一名ASP.NET C#开发人员我创建了一个博客网站,我已经开始考虑开发一个应用程序,允许我的用户在移动中发布到博客

This must be a bit of a common question (or similar to other posts) but I just wanted some information. I am a ASP.NET C# Developer I have created a blog web site and I have started looking at Developing an App that will allow my users to post to the blog on the move.

博客数据库是SQL Driven,我希望我的用户能够阅读博客文章,并通过手机上的应用程序向博客发布内容。有没有人对最佳方法有这样的建议?我正在查看适用于Windows Phone 8的SDK中的
HTML5应用程序,并且可能使用ASP.NET页面或Java脚本从SQL Server获取数据。

The blog database is SQL Driven and I would like my users to be able to read blog posts as well as post to the blog wile out and about from an App on their mobiles. Does anyone have an suggestion on the best way to go about doing this? I am looking at the HTML5 App in the SDK for Windows Phone 8 and maybe using ASP.NET Pages or Java Script to get the data from the SQL Server.

但是我我不确定是否有人有任何建议或能给我任何关于如何做到这一点的指示,我欢迎他们。我也在谷歌搜索其他方法。

But I’m not sure if anyone has any suggestion or could give me any pointers on how best to do this, I welcome them all. I am also searching Google to see what other methods are out there.

亲切的问候

Tom

TPark IT技术人员

TPark IT Technician

推荐答案

强烈建议您不要直接从移动应用程序连接到数据存储。

It's strongly adviced that you should not connect to data store directly from your mobile application.

最佳做法是,您应该为您的网络应用程序编写某种服务。使用此服务,您可以发布您的网络应用程序的数据(帖子列表,特定帖子的详细信息,评论列表等。)

Best practice is, you should write some kind of service to your web application. With this service you can publish your web application's data (list of posts, detail of spesific post, list of comments, etc.)

在您的移动应用程序中,您可以使用httprequest从您的服务中获取数据。

At your mobile application you can use httprequest to fetch data from your service.

这是示例代码;

WebClient webClient = new WebClient();
webClient.DownloadStringCompleted += new DownloadStringCompletedEventHandler(webClient_DownloadStringCompleted);
 webClient.DownloadStringAsync(new System.Uri(YOUR_SERVICE_URL));

void webClient_DownloadStringCompleted(object sender, DownloadStringCompletedEventArgs e)
 {
     if (e.Error == null)
     {
         updateScreen(e.result);
     }
}





这篇关于从远程SQL数据库中读取数据的最佳方法,最佳应用类型?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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