Return value when selecting "FOR XML" getting truncated

I'm using SQL Server 2005. I have stored procedure that selects a bunch of data from different tables and returns the results using the FOR XML clause. The problem is when I'm loading the XML, I notice that after a little over 2,000 characters, the XML string is getting truncated and thus I can't load it into an XmlDocument object. I'm also using the Microsoft Enterprise Library data access block, if that makes any difference. Here's the code:
 
Database db = DatabaseFactory.CreateDatabase(DATABASE_NAME);

string sqlCommand = "...";
using (DbCommand dbCommand = db.GetStoredProcCommand(sqlCommand))
{
	db.AddInParameter(dbCommand, "@MEMBERID", DbType.Int32, memberID);

	using (IDataReader rdr = db.ExecuteReader(dbCommand))
	{
		rdr.Read();
		string xml = (string) rdr[0];

		XmlDocument doc = new XmlDocument();
		doc.LoadXml(xml);

		return doc;
	}
	return null;
}
 
My database engineer insists that the return value's datatype is not a string, but XML instead, but if I load it into a DataSet, the corresponding DataColumn's datatype is System.String. I suspect the truncation is happening in the conversion from XML to string, but since I have no control over that, I can't find a way to get the entire XML (using Query Analyzer proves the procedure is working properly).
 
Has anyone else seen this happen or have some sort of workaround/solution? Thanks so much in advance.

Howard Cheng

http://www.howcheng.com/
0
howcheng
7/24/2006 6:16:30 PM
asp.net.sql-datasource 29906 articles. 0 followers. Follow

1 Replies
892 Views

Similar Articles

[PageSpeed] 57


 
"If you use ExecuteReader or BeginExecuteReader to access XML data, SQL Server will return any XML results greater than 2,033 characters in length in multiple rows of 2,033 characters each."
 

Howard Cheng

http://www.howcheng.com/
0
howcheng
7/24/2006 8:42:40 PM
Reply:

Similar Artilces:

How to get the value return from "select last_insert_id()" ?
After Insert() I wanna get the automatic number with "select last_insert_id()" Code :       ........         string mysqlstring = "select last_insert_id()";        MySqlDataReader myreader;        myreader = mycommand.ExecuteReader();        int userid = myreader.GetInt16(0);  ////--------------------------------???Error ! Why? hi, ry.lee.asp.net:int userid = myreader.GetInt16(0);  ////...

how to get back the value of SQL statment "select count(*) from mytable" ?
I am using mySQL as my DB and want to return the total records from a table with the following statment: // myMethod.GetDataReader return as OleDbDataReader type and it working fine with normal select statment myReader = myMethod.GetDataReader("select count(*) from gateway"); myReader.Read(); TextBox1.Text=myReader[0].ToString(); //------------------------------------------------------------------------------------------------ But there are the error message: Index was outside the bounds of the array. Description: An unhandled exception occurred during the...

Get "Mail"/"Get "News" / "Write"/"Post" buttons?
If the "Get Mail" button text changed to "Get News", and "Write" changed to "Post" when TB's in the news-reading mode, it would save me and probably others from constantly forgetting to make the change before proceeding. :-) Or is there an extension to do this which I don't know about? Thanks! Bob Bob P wrote: > If the "Get Mail" button text changed to "Get News", and "Write" > changed to "Post" when TB's in the news-reading mode, it would save me > and probably others...

siteMapNode "title" getting truncated with "..."
Let me start by saying I'm new to using the Web.sitemap and CSS files.  I managed to get a website up and running, but the title of the sub-menus being displayed are getting truncated with "..." appearing at the end. For example, if one of my siteMapNodes in Web.sitemap is defined as,  <siteMapNode url="~/MaintenancePage.aspx" title="My Title page is rather long" description="The description of the title" /> When my mousepointer hovers over the top-level menu item, the sub-menu item above displays as "My Title page is...&quo...

Returning value from bit column as "Yes" or "No"
I'm new to asp.net and datagrids but I was wondering how I could return the value from bit column in an sql stored procedure as "Yes" if the bit is set to 1 or "No" if the bit is set to 0. If possible, I'd like to make the change in the stored procedure, but if not I can do it in the datagrid. Any suggestions on how to do this would be great. Thanks, Josh you can do it either way...if you want to do it from the front end...you can use helper functions...or you can do it from the sp itself. look up Books On Line for "Case" statement... hth*******...

superreview granted: [Bug 270342] In <threadPane.js>, "Warning: function MsgSortThreadPane does not always return a value" and "Warning: function MsgToggleThreaded does not always return a value" : [
David Bienvenu <bienvenu@nventure.com> has granted Serge GAUTHERIE <gautheri@noos.fr>'s request for superreview: Bug 270342: In <threadPane.js>, "Warning: function MsgSortThreadPane does not always return a value" and "Warning: function MsgToggleThreaded does not always return a value" https://bugzilla.mozilla.org/show_bug.cgi?id=270342 Attachment 168078: (Av2b) <threadPane.js> https://bugzilla.mozilla.org/attachment.cgi?id=168078&action=edit ...

superreview cancelled: [Bug 270342] In <threadPane.js>, "Warning: function MsgSortThreadPane does not always return a value" and "Warning: function MsgToggleThreaded does not always return a value" :
neil@parkwaycc.co.uk <neil.parkwaycc.co.uk@myrealbox.com> has cancelled Serge GAUTHERIE <gautheri@noos.fr>'s request for superreview: Bug 270342: In <threadPane.js>, "Warning: function MsgSortThreadPane does not always return a value" and "Warning: function MsgToggleThreaded does not always return a value" https://bugzilla.mozilla.org/show_bug.cgi?id=270342 Attachment 166201: (Av1) <threadPane.js> https://bugzilla.mozilla.org/attachment.cgi?id=166201&action=edit ------- Additional Comments from neil@parkwaycc.co.uk <neil.parkw...

Problem on setting to DropDownList Value="id" and Text="Name" by reading values from SQL...
Hi!Well, my problem is that i don't know how to set different values on a DropDownList. I have an DropDownList and an SqlDataSource. When the aspx page loads, i want the DropDownList to fill data from a table on my SQL Server. Especially, i want each row of the DropDownList to take the Value property from the "ID" cell of my SQL Table and to take the Text property from the "Name" cell of my same SQL Table.Now, with my solution, the DropDownList takes the value for its "Value" and "Text" properties only from my  "Name" cell of my same...

How to read the xml returned by select query with "For XML Auto,Elements"
Hi all,  I am writing a select query which produces huge xml data.Now i want to read that data from my web application a save it as xml file. How can i do that. I am using asp.net vb.net.  Check if this post is helpful.http://forums.asp.net/t/1182514.aspx Thanks,Dhimant Trivedi"When the going gets tough, tough gets going.""Mark as Answer" the post(s) which helped you solve the problem...

superreview requested: [Bug 270342] In <threadPane.js>, "Warning: function MsgSortThreadPane does not always return a value" and "Warning: function MsgToggleThreaded does not always return a value" : #2
Serge GAUTHERIE <gautheri@noos.fr> has asked David Bienvenu <bienvenu@nventure.com> for superreview: Bug 270342: In <threadPane.js>, "Warning: function MsgSortThreadPane does not always return a value" and "Warning: function MsgToggleThreaded does not always return a value" https://bugzilla.mozilla.org/show_bug.cgi?id=270342 Attachment 166201: (Av1) <threadPane.js> https://bugzilla.mozilla.org/attachment.cgi?id=166201&action=edit ...

superreview requested: [Bug 270342] In <threadPane.js>, "Warning: function MsgSortThreadPane does not always return a value" and "Warning: function MsgToggleThreaded does not always return a value" : #3
Serge GAUTHERIE <gautheri@noos.fr> has asked David Bienvenu <bienvenu@nventure.com> for superreview: Bug 270342: In <threadPane.js>, "Warning: function MsgSortThreadPane does not always return a value" and "Warning: function MsgToggleThreaded does not always return a value" https://bugzilla.mozilla.org/show_bug.cgi?id=270342 Attachment 168078: (Av2b) <threadPane.js> https://bugzilla.mozilla.org/attachment.cgi?id=168078&action=edit ...

Where can I get the images used by VS2005 for "Edit, Update, Cancel"; "Select"; and "Delete"
I'm looking for small, elegant images to use in the CommandField of a GridView for Edit, Delete, and Select. Visual Studio 2005 uses images that would be perfect but I don't know where to get the files for these images so I can use them in my own project. From a GridView's Smart Tag, go to GridView Tasks | Edit Columns | Available Fields. Under CommandField there is a sub-tree with three images that are just what I need: "Edit, Update, Cancel"; "Select"; and "Delete". Does anyone know where I can find the files for these three images (.bmp, ,gif, etc.)?     I d...

How can I get a "variable value" from the "variable name"
Hi All, How can I get a "variable value" from the "variable name" ? For Example: ClassDefinition cd_def VariableDefinition vd_def cd_def = this.classdefinition For li_i = 1 To UpperBound (cd_def.VariableList) vd_def = cd_def.VariableList[li_i] MessageBox ("Variable Name: ", vd_def.name ) MessageBox ("Variable Value: ", "??????????") Next Thanks, Gustavo Which value do you expect to get? pbm_thisusuallydoesnothelp:-)) Philip Salgannik <Gustavo> wrote in message news:4069b28a.30f0.846930886@sybase.co...

Can't get away from: "Could not open in Design View. Quote values differently inside a '<% ... "value" ... %>' block."
I keep getting this error message when I try to switch to design view. This is the code that is causing it. OnClick="javascript:void(0);ToggleRowDisplay(this,'row<%# DataBinder.Eval(Container.DataItem, "Equipment_ID") %>');" When I take out this section I can go into design view without a problem. Any ideas?? is the word row has to be there?mess with the best...die like the rest...

Web resources about - Return value when selecting "FOR XML" getting truncated - asp.net.sql-datasource

Consultation Document on the Methods for Selecting the Chief Executive and for Forming the LegCo in 2012 ...
The " Consultation Document on the Methods for Selecting the Chief Executive and for Forming the LegCo in 2012 " was a document published on ...

Voting Machine Caught on Camera Casting Ballot for Democrat when Selecting Republican - YouTube
**UPDATE.... I've heard many reports that this is "just a calibration issue." I will say this... when I went to page 2 and began voting for city ...

Selecting The Right Jeans
Fit, style, cut, colour and wash all factor into the pursuit for great denim.

Clock ticking on selecting successor to Leigh Clifford at Qantas
With Qantas on course to chalk up its largest annual profit since 2008, the question now is whether chairman Leigh Clifford is looking to hang ...

Why are the reserves selecting the team?
Backbenchers are the reserves of the parliamentary system. They are newcomers.

Jackie French: Why selecting the right place for your plants is important
The secret of growing anything easily is to choose the best spot for what you want to grow.

Netflix turns to pirates when selecting new shows
Imagine the surprise, then, when the popular video streaming site admitted that it actually turns to torrenters for inspiration. "With the purchase ...

Boston Marathon bombing trial: Judge, lawyers face challenges in selecting jurors - CTV News
As the second phase of jury selection began in the federal death penalty trial of Boston Marathon bombing suspect Dzhokhar Tsarnaev, it immediately ...

Selecting cabinet one of first orders of business for Trudeau
One of the first orders of business for any new prime minister is picking a cabinet. Who is likely to make the cut?

Agile Analysis, Self-Selecting Teams, TDD & BDD in Methods & Tools Winter 2014 issue
... for software developers, testers and project managers – has just published its Winter 2014 issue that discusses Agile Analysis, Self-Selecting ...

Resources last updated: 1/14/2016 6:01:16 PM