简体   繁体   English

C#,Android和SQLite是否可以一起使用?

[英]Does C#, Android, and SQLite work together?

I was trying to implement a system, where my C# program can insert value to SQLite database, and my mobile android application can retrieve the data in SQLite. 我正在尝试实现一个系统,其中我的C#程序可以在SQLite数据库中插入值,而我的移动Android应用程序可以在SQLite中检索数据。 Note that three of them are not located in the same PC. 请注意,其中三个不在同一台PC中。 Can somebody tells me will it work conceptually? 有人可以告诉我它会在概念上起作用吗?

P/S : I was new to C#, SQLite, and Android. P / S:我是C#,SQLite和Android的新手。

Conceptually it can work. 从概念上讲,它可以工作。 You have to have your SQLite database hosted on a remote machine somewhere that both the C# application and the Android application can access from different places. 您必须将SQLite数据库托管在C#应用程序和Android应用程序都可以从不同位置访问的远程计算机上。

The great thing about databases is that they're not built to only work with a certain language. 关于数据库的伟大之处在于,它们并非仅用于某种​​语言。 Any programming language that has, either built-in or through a third party, and way to connect to the type of database you're working with, can use it; 任何内置的或通过第三方的编程语言,以及连接到您正在使用的数据库类型的方式,都可以使用它。 however you have to be conscious of differences in operating systems. 但是,您必须意识到操作系统的差异。 Two seemingly identical values transmitted from different OSes might look slightly different after being stored in your database. 从不同的操作系统传输的两个看似相同的值在存储在数据库中后可能看起来略有不同。 New line characters on Windows vs. Linux, for example, are slightly different. 例如,Windows和Linux上的换行符稍有不同。

Regarding the OP's comment: 关于OP的评论:

I read a book stating that SQLite is not a client/server database 我读了一本书,指出SQLite不是客户端/服务器数据库

SQLite is not "client/server" in that a program must access a SQLite database file directly through a SQLite driver, without the intermediary of a server (as is the case with MySQL/MSSQL/Oracle, for example). SQLite不是“客户端/服务器”,因为程序必须直接通过SQLite驱动程序访问SQLite数据库文件,而无需服务器的中介(例如,MySQL / MSSQL / Oracle就是这种情况)。 So both your C# and Android apps will need either network filesystem access to the SQLite database, or you'll need another program that does have filesystem access and that the two remote programs can talk to; 因此,您的C#和Android应用程序都将需要通过网络文件系统访问SQLite数据库,或者您需要另一个具有文件系统访问权限的程序,并且这两个远程程序可以与之通信; to wit, you must write your own "server". 智慧地说,您必须编写自己的“服务器”。

Update: To address your comment, no: I meant that those database systems already have a server, made to handle database requests from remote clients. 更新:要表达您的意见,不:我的意思是那些数据库系统已经一个服务器,可以处理来自远程客户端的数据库请求。 SQLite doesn't - you access it by using the SQLite driver to interact with the database file directly; SQLite不会-您可以使用SQLite驱动程序直接与数据库文件进行交互来访问它; hence the need for filesystem access. 因此需要文件系统访问。 So if your C# or Android app cannot access the SQLite file directly, you will need some intermediary program that can, and that program will have to talk to your C# and Android apps. 因此,如果您的C#或Android应用程序无法直接访问SQLite文件,则您将需要一些中介程序,该程序必须与您的C#和Android应用程序对话。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM