I am using a datareader to fetch a table's record values through a stored proc. but while using datareader.getstring(2) to fetch the value of the particular column, the string returned is truncated ( rest of getstrings are returning complete values). Can anyone guide me in analyzing this?
Asked
Active
Viewed 1,906 times
3
-
6You need to show us the stored proc code, maybe the values is returned as varchar(x) x smaller than the length of the actual column length? – Adriaan Stander Dec 16 '10 at 11:44
2 Answers
2
The XML data row is truncated at 2,033 characters when you use the SqlDataReader object. To resolve this problem, use the ExecuteXmlReader method to read FOR XML queries. For additional information about how to use ExecuteXmlReader with SQL Server FOR XML queries https://support.microsoft.com/en-us/kb/310378 https://support.microsoft.com/en-us/kb/316701

golfalot
- 956
- 12
- 22
0
Change your Db logic as following,
Declare @xmldata xml
set @xmldata =(<your select query>
FOR XML AUTO)
select @xmldata as returnXml
And read column returnXml from c# i.e. objReader[0]