Hi all,
I have a process, where I take a dataset from an SQL call, and need to write
an XML file from that dataset.
The data set can contain 10's of tables, each with 100's of rows, and I have
no way of knowing what the tables are, or what they contain.
I am currently using the Dataset.WriteXM L method passing an XMLWriter.
This is all currently working.
However, I now have to do the same thing but some of the datasets contain
binary data. I have tried this with just a WriteXML and a ReadXML from the
containing dataset. But the dataset that is created that reads the XML, does
not contain the correct binary data.
I know it is possible to write binary data using the XMLWriter.Write Base64
method, but that would mean I would need to code the entire dataset write
with individual XMLWriter.Write xxxxx methods, which I would like to avoid
doing.
Is there any way, using Dataset.WriteXM L to have the binary data, written
out in Base64 automatically?
Possibly changing the actual data in the dataset prior to writing the XML,
or even if I really had to I could modify the output from SQL in some way.
As always, an and all help is appreciated, and thanks in advance for your
replies.
Simon. 4 7760
You might want to look into FOR XML clause if you are running MSSQL 2000 or
2005, this will do all the XML logic in the database instead, makeing it
somewhat easier for you.
"Simon" <s@v.c> skrev i melding
news:42******** *************** @ptn-nntp-reader01.plus.n et... Hi all,
I have a process, where I take a dataset from an SQL call, and need to write an XML file from that dataset.
The data set can contain 10's of tables, each with 100's of rows, and I have no way of knowing what the tables are, or what they contain.
I am currently using the Dataset.WriteXM L method passing an XMLWriter.
This is all currently working.
However, I now have to do the same thing but some of the datasets contain binary data. I have tried this with just a WriteXML and a ReadXML from the containing dataset. But the dataset that is created that reads the XML, does not contain the correct binary data.
I know it is possible to write binary data using the XMLWriter.Write Base64 method, but that would mean I would need to code the entire dataset write with individual XMLWriter.Write xxxxx methods, which I would like to avoid doing.
Is there any way, using Dataset.WriteXM L to have the binary data, written out in Base64 automatically?
Possibly changing the actual data in the dataset prior to writing the XML, or even if I really had to I could modify the output from SQL in some way.
As always, an and all help is appreciated, and thanks in advance for your replies.
Simon.
Hi,
The writexml method will convert a byte array (binary data) to a
base64 string. Convert.FromBas e64String will convert it back to an byte
array. Here is a link to a pocket pc app I wrote that retrieves an image
from an xml file. Hope that helps http://www.thomscontent.com/willcode...magecolumn.zip
Ken
------------------------
"Simon" <s@v.c> wrote in message
news:42******** *************** @ptn-nntp-reader01.plus.n et...
Hi all,
I have a process, where I take a dataset from an SQL call, and need to write
an XML file from that dataset.
The data set can contain 10's of tables, each with 100's of rows, and I have
no way of knowing what the tables are, or what they contain.
I am currently using the Dataset.WriteXM L method passing an XMLWriter.
This is all currently working.
However, I now have to do the same thing but some of the datasets contain
binary data. I have tried this with just a WriteXML and a ReadXML from the
containing dataset. But the dataset that is created that reads the XML, does
not contain the correct binary data.
I know it is possible to write binary data using the XMLWriter.Write Base64
method, but that would mean I would need to code the entire dataset write
with individual XMLWriter.Write xxxxx methods, which I would like to avoid
doing.
Is there any way, using Dataset.WriteXM L to have the binary data, written
out in Base64 automatically?
Possibly changing the actual data in the dataset prior to writing the XML,
or even if I really had to I could modify the output from SQL in some way.
As always, an and all help is appreciated, and thanks in advance for your
replies.
Simon.
Thanks to both Inge, and Ken.
Inge, interesting I didn't know about the For XML clause in MSSQL. Could
prove usefull in the future.
Ken, thanks for the link, but I'm trying to just use the DataSet.WriteXm l,
and ReadXml methods, as I don't want to run down all the columns, for each
table in the data set creating the elements by hand as it were.
I have solved this by preprocessing the dataset, and creating a secondary
column when binary data is encountered. I can then encode the second column
a base64, and remove the original column. Then do the reverse step in the
XML file input stage.
This then negates the need to read and write the manual XML writes, and it
is all now working.
Thanks again for your replies.
Simon.
"Simon" <s@v.c> wrote in message
news:42******** *************** @ptn-nntp-reader01.plus.n et... Hi all,
I have a process, where I take a dataset from an SQL call, and need to write an XML file from that dataset.
The data set can contain 10's of tables, each with 100's of rows, and I have no way of knowing what the tables are, or what they contain.
I am currently using the Dataset.WriteXM L method passing an XMLWriter.
This is all currently working.
However, I now have to do the same thing but some of the datasets contain binary data. I have tried this with just a WriteXML and a ReadXML from the containing dataset. But the dataset that is created that reads the XML, does not contain the correct binary data.
I know it is possible to write binary data using the XMLWriter.Write Base64 method, but that would mean I would need to code the entire dataset write with individual XMLWriter.Write xxxxx methods, which I would like to avoid doing.
Is there any way, using Dataset.WriteXM L to have the binary data, written out in Base64 automatically?
Possibly changing the actual data in the dataset prior to writing the XML, or even if I really had to I could modify the output from SQL in some way.
As always, an and all help is appreciated, and thanks in advance for your replies.
Simon.
Hi Simon,
I am interested in the final code you used to solve your problem. I am
using a socket connection to receive XML files (text and images) into a
buffer which I convert to a string. I am using a XMLTextReader to read the
string into a dataset, well, I have been up to now. I want to know how you
encoded your byte array when first received (I used
System.Text.Enc oding.ASCII.Get String up til now) The Base64 encoding works
wonderfully when only sending the pic (without any XML).
What I would like to do is store everything in my dataset, write the pics to
their separate files, and delete that column from the datatable.
Any help would be appreciated.
Thanks,
Mariza
"Simon" wrote: Thanks to both Inge, and Ken.
Inge, interesting I didn't know about the For XML clause in MSSQL. Could prove usefull in the future.
Ken, thanks for the link, but I'm trying to just use the DataSet.WriteXm l, and ReadXml methods, as I don't want to run down all the columns, for each table in the data set creating the elements by hand as it were.
I have solved this by preprocessing the dataset, and creating a secondary column when binary data is encountered. I can then encode the second column a base64, and remove the original column. Then do the reverse step in the XML file input stage.
This then negates the need to read and write the manual XML writes, and it is all now working.
Thanks again for your replies. Simon.
"Simon" <s@v.c> wrote in message news:42******** *************** @ptn-nntp-reader01.plus.n et... Hi all,
I have a process, where I take a dataset from an SQL call, and need to write an XML file from that dataset.
The data set can contain 10's of tables, each with 100's of rows, and I have no way of knowing what the tables are, or what they contain.
I am currently using the Dataset.WriteXM L method passing an XMLWriter.
This is all currently working.
However, I now have to do the same thing but some of the datasets contain binary data. I have tried this with just a WriteXML and a ReadXML from the containing dataset. But the dataset that is created that reads the XML, does not contain the correct binary data.
I know it is possible to write binary data using the XMLWriter.Write Base64 method, but that would mean I would need to code the entire dataset write with individual XMLWriter.Write xxxxx methods, which I would like to avoid doing.
Is there any way, using Dataset.WriteXM L to have the binary data, written out in Base64 automatically?
Possibly changing the actual data in the dataset prior to writing the XML, or even if I really had to I could modify the output from SQL in some way.
As always, an and all help is appreciated, and thanks in advance for your replies.
Simon. This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: john smith |
last post by:
Hi, I have a file format that is going to contain some parts in ascii, and
some parts with raw binary data. Should I open this file with ios::bin or
no?
For example:
filename: a.bin
number of points = 123
@@@begin data@@@
gibberish follows.....
|
by: Simon |
last post by:
Hi all,
I have a process, where I take a dataset from an SQL call, and need to write
an XML file from that dataset.
The data set can contain 10's of tables, each with 100's of rows, and I have
no way of knowing what the tables are, or what they contain.
I am currently using the Dataset.WriteXML method passing an XMLWriter.
|
by: Hanover |
last post by:
I have looked fot his solution, but Im not sure what to search for.
I have an asp.net based report. I need the user to be able to download
an XML file of the results so they can use the data in Excel, etc.
I do NOT want to write the file to the server first. I just want to be
able to write the contents of the Dataset into a binary file and send
it back out to the user as a download, but all in memory.
Can you give me a boost in the...
|
by: Jeevan |
last post by:
Hi,
I have an array of data (which I am getting from a socket connection).
I am working on a program which acts on this data but the program is
written to work on data from a file (not from an array). I cannot
change anything in the program but can add some features by which I
can convert this array of data into a file. The easiest thing would be
to write the data into a file (in hard disk) and use it. But I will be
working on thousands...
|
by: dba123 |
last post by:
I need some help and direction on what classes and an example or two
(article) on how to read an Excel Worksheet and insert one column into a
database table column. I am using .NET 2.0 only. What namespaces and
classes should I use and how?
--
dba123
| |
by: UJ |
last post by:
I have a system that has five programs that all communicate with each other
via Message Queues. Works well. One program is a watchdog that will make
sure the others are up and going. Currently I have it store info it gets
from when the programs check in into a DataSet (XML file). Problem is, that
file now has to be used by other programs to find out version information
(the file is ALWAYS less that 1K.) The record itself is only five fields...
|
by: arne.muller |
last post by:
Hello,
I've come across some problems reading strucutres from binary files.
Basically I've some strutures
typedef struct {
int i;
double x;
int n;
double *mz;
|
by: David |
last post by:
Hi,
(Sorry for duplicate post, finger trouble before I finished...)
using C# 1.1
I am writing a winform app that collects a dataset from a webservice.
At the same time I collect the data, I write the dataset out to the local
disk using DataSet.WriteXml, so that if the webservice is not available,
|
by: swetha |
last post by:
HI Every1,
I have a problem in reading a binary file.
Actually i want a C program which reads in the data from a file which
is in binary format and i want to update values in it.
The file consists of structures of type----
struct record {
int acountnum;
char name;
float value;
|
by: Lucvdv |
last post by:
This would better be described by 'serialization' than 'interop', but I
didn't find a newsgroup that seems closer on topic.
The problem in a few words: I save data with DataSet.WriteXML, but I get
different data back when I read it later with DataSet.ReadXml.
More detail:
|
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: 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: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
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: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
| |
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...
| |