(After thinking about it, maybe this should have been posted in the .NET forum...)
Hi,
I have a stored procedure in SQL Server that sends me a 3000+ char pre-formatted XML string. I use "FOR XML EXPLICIT" and it works really well when I do the query in Management Studio.
But, when it comes to output, something goes wrong. My output code is very basic, I don't know if it could be better. I use ExecuteScalar since the procedure returns the pre-formatted XML string in a 1X1 "table".
Response.Write( "<?xml version=""1.0"" encoding=""UTF-8"" ?>")
Response.Write( "<Listelivraiso ns>") 'This is the "root element
Response.Write( db.ExecuteScala r(cmdCalendrier _xml))
Response.Write( "</Listelivraisons >") 'End of the root
I can see string but the later half (or so) of it is missing.
Actually, if I look at the source of my XML page with IE, I can see that the file ends with :
<Livraison id="6"><JOB_NO> 68756</JOB_NO><CUST_C</Listelivraisons >
I really don't know why. When I execute the query with Management Studio, the "livraison" id 6 is complete and there's even another record of two after it. But it just won't show if I Response.Write.
I tried using DataReader and other things instead of ExecuteScalar, it didn't change a thing. I tried using Response.Output .Write, with no dice.
Should I be using a buffer or something??
4 5304 CroCrew 564
Recognized Expert Contributor
Hello myth0s,
It somewhat sounds like you need to flush out the response. Are you looping your “response.write ”s? If you are then try flushing between loops using the “response.flush ” command.
Sorry for the short possible answer. But, I will look for a better one.
Hope this helped out~
Hello myth0s,
It somewhat sounds like you need to flush out the response. Are you looping your “response.write ”s? If you are then try flushing between loops using the “response.flush ” command.
Sorry for the short possible answer. But, I will look for a better one.
Hope this helped out~
No, I'm not looping Response.Write since ExecuteScalar returns the string directly. (ExecuteScalar is "designed" to return the value of the first row of the first column, instead of a DataSet).
I have added Response.flush nonetheless, hoping it would help, but no. I have a vague felling that my string is too long or something. I used MS Word to count and the string always cuts off after exactly 2033 characters.....
No, I'm not looping Response.Write since ExecuteScalar returns the string directly. (ExecuteScalar is "designed" to return the value of the first row of the first column, instead of a DataSet).
I have added Response.flush nonetheless, hoping it would help, but no. I have a vague felling that my string is too long or something. I used MS Word to count and the string always cuts off after exactly 2033 characters.....
Now that I have noticed that my string cuts off after 2033 characters, I have found this : http://www.informit.co m/articles/article.aspx?p= 25339&seqNum=4
I will let you know if it works :/
Now that I have noticed that my string cuts off after 2033 characters, I have found this : http://www.informit.com/articles/art...25339&seqNum=4
I will let you know if it works :/
Should anyone find this page using google while searching why in the world their string was being trimmed down (incomplete data, missing data). Apparently, even if you use ExecuteScalar, the string is cut to 2033 characters.
The solution is in the link above. It works great with SQL Server returning "FOR XML" data.
I have changed my output code to - Dim db As Database = DatabaseFactory.CreateDatabase("SQLServer") 'I am using Enterprise Library from Microsoft
-
Dim cmdCalendrier_xml As DbCommand = db.GetStoredProcCommand("production.lv_calendrier_xml")
-
db.AddInParameter(cmdCalendrier_xml, "@date_activite_min", DbType.Date)
-
-
Dim buffer As System.Text.StringBuilder = New System.Text.StringBuilder()
-
buffer.Append("<?xml version=""1.0"" encoding=""UTF-8"" ?>")
-
buffer.Append("<Listelivraisons>")
-
-
Dim dataReader As IDataReader = db.ExecuteReader(cmdCalendrier_xml)
-
-
While (dataReader.Read())
-
buffer.Append(dataReader.GetString(0))
-
End While
-
-
buffer.Append("</Listelivraisons>")
-
Response.Write(buffer.ToString)
Thanks for your help, CroCrew
Sign in to post your reply or Sign up for a free account.
Similar topics |
by: marslee |
last post by:
How to write data in a file to the next line
fwrite($ourFileHandle , $_POST);
fwrite($ourFileHandle , "\n");
fwrite($ourFileHandle , $_POST);
I want the following output
Peter
Main.st
|
by: Mark Anderson |
last post by:
I have code to develop result page links (like a search engine) for some
results being passed from a database where I've no server-sdide acces -
thus JS.
The code is below and works fine except the function in the onClick
event of the link being written on screen fails indicating 'theForm' as
being passed through is 'not defined'. The form is being passed as
"document.resultAdd" and can be checked as arriving in my function.
So what...
|
by: Von Shean |
last post by:
I use the following code to format the numbers to have commas. But in case
when input is zero it returns an empty string....any ideas?
String.Format("{0:#,###.##}",dblNum);
|
by: Mullin Yu |
last post by:
i want to build an application of both gui and batch interface by using
windows application project.
i check either passing any args or not. if no, then open the gui
application. if yes, use the batch interface.
my problem is that i can output the string to the dos prompt when running
the exe file at dos prompt:
c:\>test.exe /?
|
by: roopeman |
last post by:
i need your help, my code as below :
//-----------------------------------------------------------------------
//Wrote by Michael April 30 2005
//-----------------------------------------------------------------------
using System.Text;
using System.Diagnostics;
using System.Threading;
| |
by: Mr. x |
last post by:
Hello,
I have declared in my program (*.aspx) something like this :
<%@ Page Language="VB" Debug="true" %>
....
<%
dim current_view_page
current_view_page = "1"
|
by: dinny |
last post by:
I am getting an extra character at te beginning of the file,
can someone please check if there is an error in my code?
Dim fs As FileStream
fs = New FileStream(Form1.REGFILE, FileMode.CreateNew, FileAccess.Write)
Dim gw As New BinaryWriter(fs)
gw.Write(s)
gw.Flush()
gw.Close()
fs.Close()
|
by: MJK |
last post by:
Suppose I have the following function in my program:
void ExtractData(Ind *AM)
{
int i,j;
char str;
char c;
FILE *ext=fopen("test.out","r");
//suppose I have N line each with M digits (in here M=5) like: 1 2 2
|
by: ravimishra11 |
last post by:
Hi friends,
I have written code in asp.net to read or write string in com port(COM1).But when i run the program i am not getting any output .Below is my code .How can i check the string which i have send in com port is available in com port for read.
private SerialPort port = new SerialPort("COM1", 9600, Parity.None, 8, StopBits.One);
port.Open();
// port.Write("He");
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
| |
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |