Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/svn/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# 将stamp转换为varchar并在c中使用_C#_Sql Server - Fatal编程技术网

C# 将stamp转换为varchar并在c中使用

C# 将stamp转换为varchar并在c中使用,c#,sql-server,C#,Sql Server,我创建了一个存储过程,使用C服务使用最后一个戳记将表中的数据从主数据库同步到分支。在存储过程中,我将主数据库的stamp转换为varchar select@CurrentStamp=convertvarchar,参数中的值,其中id=3此戳记我应该在C中获取它作为输出,并将其作为参数发送到分支中的存储过程保存我应该同步的数据,然后将此戳记作为varchar保存在参数表中。所有这些都是在不使用soap服务的情况下通过测试实现的。当我试图在soap服务中使用它时,它抛出一个异常十六进制值0x00,这

我创建了一个存储过程,使用C服务使用最后一个戳记将表中的数据从主数据库同步到分支。在存储过程中,我将主数据库的stamp转换为varchar select@CurrentStamp=convertvarchar,参数中的值,其中id=3此戳记我应该在C中获取它作为输出,并将其作为参数发送到分支中的存储过程保存我应该同步的数据,然后将此戳记作为varchar保存在参数表中。所有这些都是在不使用soap服务的情况下通过测试实现的。当我试图在soap服务中使用它时,它抛出一个异常十六进制值0x00,这是一个无效字符。任何帮助,请我试图将其转换为varbinary,但它不断地将戳记更改为另一个值。如果有人知道如何让XML毫无例外地读取这些值,请提供帮助

FamilyService.FamilyService fs = new FamilyService.FamilyService();
DataSet ds = fs.GetFamilyToSynchronize(Current.LoggedUserSchool.ID, stamp, out currentStamp);
-

SQL存储过程

GO
ALTER Proc [dbo].[GetFamilyToSynchronize] (@SchoolID int , @Stamp varchar(255) = null, @CurrentStamp varchar(255) output) as

select @CurrentStamp = convert(varchar, value) from parameter where id = 3

SELECT f.*
into #tmpFamily
FROM [Family] f
inner join fatherschools fs on fs.FamilyID =  f.ID
where f.id  =f.fatherlinkid --not in (select FatherLinkID from family )
and schoolID = @SchoolID
and (@Stamp is null or f.stamp> convert(timestamp, isnull(@Stamp,'')))

select distinct f.id, phonetypeid,phonenumber, t.FatherLinkID
from familyphones f
inner join #tmpFamily t on t.ID = f.FamilyID

select * from #tmpFamily

发生错误是因为数据库返回空十六进制0。检查您的存储过程是否返回有效值。方法是将数据库中的时间戳从timestamp转换为varchar。我知道它返回的是nullhex 0,我需要它。有解决方案吗?在@currentstamp行中添加coalesce或isnull,并将其合并为空字符串。您的soap服务必须知道如何处理空字符串,但null是soap字符串中的无效字符。请注意:您知道时间戳不是DATETIME数据类型,而只是用于版本戳的二进制值。在新的SQL Server中,它被调用rowversion@paqogomez我需要发送它,因为我想它同步的数据第二次从这个印章开始。我数据库中的数据非常大,我不能每次都同步。
GO
ALTER Proc [dbo].[GetFamilyToSynchronize] (@SchoolID int , @Stamp varchar(255) = null, @CurrentStamp varchar(255) output) as

select @CurrentStamp = convert(varchar, value) from parameter where id = 3

SELECT f.*
into #tmpFamily
FROM [Family] f
inner join fatherschools fs on fs.FamilyID =  f.ID
where f.id  =f.fatherlinkid --not in (select FatherLinkID from family )
and schoolID = @SchoolID
and (@Stamp is null or f.stamp> convert(timestamp, isnull(@Stamp,'')))

select distinct f.id, phonetypeid,phonenumber, t.FatherLinkID
from familyphones f
inner join #tmpFamily t on t.ID = f.FamilyID

select * from #tmpFamily