Re: SQL to XML File

Tech-Archive recommends: Fix windows errors by optimizing your registry



When you say "the recordset is below that" - what do you mean?
For this scenario, can I just paste some code from a (working)
Click-style event handler?

HttpResponse resp = HttpContext.Current.Response;
resp.Clear();
resp.ContentType = "text/xml"; // or whatever
resp.AddHeader("Content-Disposition",
"attachment;filename=somefile.xml");
using (XmlReader reader = SeeBelow())
using (XmlWriter writer =
XmlWriter.Create(HttpContext.Current.Response.Output))
{
reader.MoveToContent();
writer.WriteNode(reader, false);
writer.Close();
}
resp.End();

where SeeBelow() is something that returns an XmlReader, such as
SqlCommand.ExecuteXmlReader. You can also just use ExecuteReader and
read the character data (either as a single string, or in a char[]
buffer), but the above is fine in most scenarios.

Marc


.



Relevant Pages

  • Re: Trouble with DAO "SEEK" in converting application to SQL Express back end.
    ... Opening the recordset ... FindFirst took 3+ seconds. ... most high-performance scenario. ... in a recordset since I have apps that basically do the same thing in ...
    (comp.databases.ms-access)
  • Re: Displaying data to 2 decimal points
    ... Given that you have not provided any details about your scenario (where are ... Reading the data from the fields in the recordset?), ... A Google search or a search of www.aspfaq.com could also provide you ... This email account is my spam trap so I ...
    (microsoft.public.inetserver.asp.general)
  • Re: Displaying data to 2 decimal points
    ... Given that you have not provided any details about your scenario (where are ... Reading the data from the fields in the recordset?), ... A Google search or a search of www.aspfaq.com could also provide you ... This email account is my spam trap so I ...
    (microsoft.public.sqlserver.setup)
  • Re: Select Query Help
    ... > I want to extract weekly report from access dataabse into recordset. ... > Scenario is as follows ...
    (microsoft.public.vb.database)
  • Select Query Help
    ... I want to extract weekly report from access dataabse into recordset. ... Scenario is as follows ... obviously Weeks should be reset when month changes. ... Its urgent plz help ...
    (microsoft.public.vb.database)