Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Converting data set to single string and back? 1

Status
Not open for further replies.

djjd47130

Programmer
Nov 1, 2010
480
US
I've been working a lot with sockets, and was looking for a clever way to pack a dataset (like a TADOQuery) into a single string and stream it. I'm already very familiar with building packets, just very poor at data sets. There may be some way to convert it to a stream its self, and restore it back from a stream on the other end. Or when the dataset receives the data from the server, it must already be in some raw string format which I can re-direct through my sockets. Overall, I'd like to make sure it's as speedy as possible.

JD Solutions
 
Using TXMLDocument you can build an XML document from your dataset. TXMLDocument has a SaveToStream method.
 
Thanks, but I'm afraid that's adding an extra layer of conversion. My goal is to eliminate as many conversion steps as possible to speed up performance, because this will be a lot of data being transferred.

JD Solutions
 
you have 3 options here:

- use the SaveToFile Method and stream the file
- loop through the rows and fields.
-> implement a savetostream method through a memory stream.
look here for sample code:
This will require a higher version of ADO (should be no problem from XP and higher)

-> the first methods is pretty straightforward, but will be slow
-> the second method will be faster but will require a lot more programming (think about BLOBs and stuff)

/Daddy



-----------------------------------------------------
What You See Is What You Get
Never underestimate tha powah of tha google!
 
Thanks, that about answers my question. I'll go ahead with the memory stream method, quick and easy.

JD Solutions
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top