如何连接在线数据库Xamarin? [英] How to connect online DB Xamarin?

查看:406
本文介绍了如何连接在线数据库Xamarin?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

请告诉我如何从在线数据库(表)中检索数据?我刚刚在在此处输入链接描述

中创建了一个表

然后我建立了一个SQL数据库.谁能告诉我如何从中检索数据?

解决方案

强烈建议您不要直接从Xamarin直接连接到数据库,这至少有两个独特的原因: 1.您用于数据库的凭据将出现在您的应用程序代码中,这意味着任何人都可以反编译您的应用程序并读取您的登录信息-巨大的安全风险. 2.通过直接从Xamarin连接到在线数据库,您很可能会使数据库服务器超载(它们仅允许少量连接).

通常,当您需要数据库中的数据时,可以使用自己构建的API.例如,一个php站点或一个ASP.NET Web api.

Xamarin与您的网站进行通信(例如www.yoursite.com/api/getinformation).这样,您的凭据在网站中是安全的,并且您的应用程序仅连接到您的站点,这样做更好,因为您可以在该站点中缓存信息,从而防止站点过载.

阅读对您有帮助的材料:

通过使用REST-API

please tell me how to retrieve a data from online database(table)?. I just created a table in enter link description here

And I made a SQL database. And can anyone tell me how to retrieve a data from that?

解决方案

It is strongly advised for you to not directly connect to a database straight from Xamarin for (at the very least) 2 distinctive reasons: 1. Your credentials for the database will be in your app code, meaning anyone can just decompile your app and read your login info - huge security risk. 2. By connecting to a online database straight from Xamarin you'll most probably overload the database server (they allow only a small number of connections).

Usually when you need data from a database you work with an API that you build yourself. For example A php site, or an ASP.NET web api.

Xamarin communicates with your web site (e.g. www.yoursite.com/api/getinformation). This way your credentials are safe in the website, and your app connects only to your site, which is better because you can cache information there, preventing an overload on your site.

Reading material that will help you:

Xamarin forum link to php+mysql+Xamarin

Consuming REST-API's with

这篇关于如何连接在线数据库Xamarin?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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