views:

265

answers:

3

Hi all

How do i send files using TClientDataSet?

i am using Delphi2010

thanks

vladimir.

My appologies for the confusion, my intention is to send/tranfer pdf files from one TCLientDataSet to Onother... we are using MIDAS... thanks

A: 

Can you explain ytour question? To me it seems that sending file has nothing to do with a TClientDataSet. Do you want to put a binary file in a field? Do you want to send a file over e-mail?

birger
I think he has a streaming/syncing mechanism/link based on tclientdataset, and wants to synchronize files over that link
Marco van de Voort
A: 

I'm assuming you want to move client datasets from machine to machine. Just use TClientDataSet.SaveToFile to write it to a file, and send the file using whatever transport suits you. Use LoadFromFile on the receiver to load the CDS back. I would suspect there's a SaveToStream as well, which would allow you to write it to RAM and send it over a socket.

Brad Brown
-1 vladimir indicates he is using MIDAS (which is now called DataSnap) as his transport.
Jeroen Pluimers
He indicated he was using MIDAS after my original post. He hasn't specified the transport method. In other words, "I'm using Midas" doesn't tell me how you're getting the dataset from point A to point B.
Brad Brown
+2  A: 

If your files are saved in one of the fields of ClientDataset as BLOB data, and your ClientDataset is connected to a remote DatasetProvider using DataSnap, then just calling TClientDataset.ApplyUpdate is enough to send the changed data from client to DataSnap server.

If your ClientDataset just stores file name, and file content is not saved into database, then you should upload the file to server separately. To upload the file to server, you can define a server method which takes a stream as its parameter, and call it from your client application.

If you don't know how to add a server method to your DataSnap 2010 server, then I suggest you read Bob Swart's "Delphi 2010 DataSnap: Your data where you want it, how you want it"

vcldeveloper