Error while passing empty string(system.dbnull.value.tostring) to sp_xml_preparedocument xmltext

24 views
Skip to first unread message

SAN

unread,
Aug 28, 2008, 2:58:52 AM8/28/08
to DotNetDevelopment, VB.NET, C# .NET, ADO.NET, ASP.NET, XML, XML Web Services,.NET Remoting

I am getting an error as
"XML Document must have a top level element.Could not find prepared
statement with handle 0." while using an SP. Sp accepts ntext input
parameters.The value for this ntext parameters come from strings
assigned as my Dataset.getxml.In some cases I dont require some
datasets to be passed.In that case i pass the string as
System.DBNULL.value.tostring

And in my SP i am checking

IF @dataSSDTL IS NOT NULL
begin
exec sp_xml_preparedocument @hDoc output, @dataSSDTL

----

--
end


I am using sqlhelper.executenonquery to call the SP.
I think the problem is that ntext input parameter of SP is not getting
the value as NULL. instead its getting as empty string.If I am passing
this parameters from VB.NET as string, how can I handle this issue..

CK

unread,
Aug 29, 2008, 8:14:31 AM8/29/08
to DotNetDevelopment, VB.NET, C# .NET, ADO.NET, ASP.NET, XML, XML Web Services,.NET Remoting
how about:
> IF @dataSSDTL IS NOT NULL AND @dataSSDTL != ''
> begin
> exec sp_xml_preparedocument @hDoc output, @dataSSDTL
>
> ----
>
> --
> end

duh.

ramireddy dasaradha

unread,
Aug 30, 2008, 8:27:13 AM8/30/08
to DotNetDe...@googlegroups.com
in stored procedure check whether emptystring or not
if(@yourparamname = '')
  set @yourparamname = null;
 
 
 
and another way is using  like
nullif(@yourparamname,'')  
Reply all
Reply to author
Forward
0 new messages