在客户端和SQL Server之间传输数据 [英] transfer data between clients and sql server

查看:113
本文介绍了在客户端和SQL Server之间传输数据的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个问题



每个客户端在一段时间后通过按下同步信息分别在数据库中传输到服务器。



这里我们有一个数据库服务器。所有客户端数据都传输到基站。

服务器还负责清理和编辑数据



1.什么是数据传输协议?

2.预防冗余数据的传输?

3.检测并删除通过编辑和与服务器同步?

i have one problem

Each client separately in the database after a certain period of time by pressing the sync information is transmitted to the server.

Here we have a database server.All client data is transferred to the base.
The server is also responsible for cleaning and editing data

1.What is the data transfer protocol?
2.Prevent transmission of redundant data؟
3.Detected and removed by editing and synchronization with the server؟

推荐答案

我想您应该说如何将数据从客户端发送到SQL Server。我会使用HTTP,你应该知道HTTP足够强大,可以用作这个。已经在HTTP / HTTPS上构建了许多API。



发送数据时可以使用POST请求。您可以在此处了解有关从SQL Server(或整个Web服务器)向/从客户端发送数据的方法的更多信息, https://en.wikipedia.org/wiki/POST_(HTTP) [ ^ ]



第二个问题很简单,SQL Server有一个内置函数来删除冗余数据。例如,如果您希望ClientID是唯一的,则可以将其设置为数据库中的PrimaryKey,数据库将自动使用户无法添加重复数据。您可以将两个或更多列创建为Unique字段,它们也称为CompositeKeys。因此,您不需要再为此编码。



更多关于主键的信息, http://technet.microsoft.com/en-us/library/ms191236(v = sql.105).aspx [ ^ ]



不要阻止用户编写任何类型的数据,直到他写入停止你的进程。按下按钮以将数据与SQL Server同步后,对其中的数据进行验证。将数据发送到服务器并检查是否有任何重复,如果有,则通过向他显示错误消息来阻止他添加数据。
I think you meant to say how should you be sending the data from client to the SQL Server. I would use HTTP for this, you should know HTTP is powerfull enough to be used as this. There are many APIs already built on HTTP/HTTPS.

POST requests can be used while sending the data. You can learn more about this method of sending the data from/to client from SQL Server (or the web server as a whole) here, https://en.wikipedia.org/wiki/POST_(HTTP)[^]

Your second question is a simple one, SQL Server has a built-in function to remove the redundant data. For example, if you want the ClientID to be unique, you can make it a PrimaryKey in the Database and Database will automatically make it impossible for the user to add duplicate data. You can have two or more columns made a Unique field too, they're known as CompositeKeys. So, you won't need any more coding for this one.

More on Primary key here, http://technet.microsoft.com/en-us/library/ms191236(v=sql.105).aspx[^]

Do not stop the user from writing any sort of data, until he is writing stop your processes. Once he presses the button to synchronize the data with the SQL Server, do the Validation for the data there. Send the data to the server and check for any duplication, if there is then prevent him from adding the data by showing him an error message.


这篇关于在客户端和SQL Server之间传输数据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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