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

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

问题描述

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

中创建了一个表格

我制作了一个 SQL 数据库.谁能告诉我如何从中检索数据?

解决方案

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

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

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

阅读对您有帮助的材料:

Xamarin 论坛链接到 php+mysql+Xamarin

使用 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

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

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