Reputation: 41
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?
Upvotes: 3
Views: 2210
Reputation: 1
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]
Upvotes: 0
Reputation: 1294
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
Upvotes: 2