DBServerSyncProvider SelectClientIdCommand同步服务Ado.Net

时间:2021-03-18 09:37:44

I want to use the DBServerSyncProvider's SelectClientIdCommand but i don't wan't to add more tables to my data base, i want to specifically define the clients id (as a long), something like this:

我想使用DBServerSyncProvider的SelectClientIdCommand,但我不想在我的数据库中添加更多表,我想专门定义客户端ID(如长),​​如下所示:

long ClientIdentifier=540;

SqlCommand ClientIdComm = new SqlCommand();
ClientIdComm.CommandType = CommandType.Text;

ClientIdComm.CommandText = " declare @sync_originator_id bigint "+
                                    " set @sync_originator_id= " +ClientIdentifier +
                                    " select @sync_originator_id "; 

            serverSyncProvider.SelectClientIdCommand = ClientIdComm;

this will throw "Failed to map client ID to originator ID. Make sure the command DbServerSyncProvider.SelectClientIdCommand is correct."
what am I doing wrong? tks

这将抛出“无法将客户端ID映射到发起者ID。请确保命令DbServerSyncProvider.SelectClientIdCommand正确。”我究竟做错了什么? TKS

1 个解决方案

#1


ok, found out that @Sync_originator_id accepts Int, but not BigInt, is there anyway to pass a bigint as the client identifier?

好的,发现@Sync_originator_id接受Int,但不接受BigInt,无论如何都要传递一个bigint作为客户端标识符?

#1


ok, found out that @Sync_originator_id accepts Int, but not BigInt, is there anyway to pass a bigint as the client identifier?

好的,发现@Sync_originator_id接受Int,但不接受BigInt,无论如何都要传递一个bigint作为客户端标识符?