SyncSession SyncOriginatorId Data Type as nvarchar RRS feed

  • Question

  • Hi,

    I'm using Sync Framework with SqlExpressClientSyncProvider to sync SQL Express 2005 with the SQL Server 2005.
    I notice that SyncOriginatorId allow us to define SyncOriginatorId parameter data type to any SqlDbType.

    But After I change datatype to NVarChar as code below the program throw an error message with "string[1] : The size property has an invalid size of 0 ".

    Everything work fine if I revert all the SyncOriginatorId, insertOriginatorId
    and updateOriginatorId back to int data type.

    Code Snippet

    private SqlCommand ClientIDCommand() { SqlCommand selectClientIdCommand = new SqlCommand(); selectClientIdCommand.CommandType = CommandType.StoredProcedure; selectClientIdCommand.CommandText = "usp_GetOriginatorId"; selectClientIdCommand.Parameters.Add("@" + SyncSession.SyncClientId, SqlDbType.UniqueIdentifier); selectClientIdCommand.Parameters.Add("@" + SyncSession.SyncOriginatorId, SqlDbType.NVarChar).Direction = ParameterDirection.Output; return selectClientIdCommand; }

    It's a framework limitation or I have done something wrong with my coding.
    The Idea was my existing table already have a column for insertby and updateby with a datatype of nvarchar(50).
    I wish to untilize back the same column for the synchornization purpose.

    • Moved by Max Wang_1983 Thursday, April 21, 2011 5:58 PM forum consolidation (From:SyncFx - Technical Discussion [ReadOnly])
    Friday, December 26, 2008 11:01 AM


  • Hi  Matrixgoh,


    the syncOriginatorId should be a Int data type. Please see BOL ms-help://MS.SynchronizationServices.v1.EN/syncdata1/html/1daf5591-d4aa-493a-81e5-6374a1e86da9.htm for the usage.


    in this case, what you can do is to map what you have already have to an int ( you need to provide this logic in the sqlcommand as shown in the sample. Please be aware doing this will affect the sync performance.






    Saturday, January 3, 2009 4:43 AM