Encrypting a datatable

J

John Wright

I need to covert a datatable to a string so I can pass it into my encryption
engine. I need to know how to write the xml for a dataset into a string
variable so I can pass the string into the encryption engine. I don't want
to persist the data on disk, I want to be able to do this in memory so I can
discard the string variable when I am done. The engine in use here will only
accept strings for encryption.


John Wright
 
C

Cor Ligthert [MVP]

John,

It is in this message converted from VB so watch simple errors

'Serialize
System.IO.StringWriter sw = new System.IO.StringWriter();
MyDataset.WriteXml(sw);
string mystring = sw.ToString();
''''''''''''''''''''''''''''''''''''''
'Deserialize
System.IO.StringReader sr = new System.IO.StringReader(mystring);
DataSet ds2 = new DataSet();
ds2.ReadXml(sr);

I thought that this was very simple?

Cor
 
J

John Wright

Wow that is simple. Thanks.

John
Cor Ligthert said:
John,

It is in this message converted from VB so watch simple errors

'Serialize
System.IO.StringWriter sw = new System.IO.StringWriter();
MyDataset.WriteXml(sw);
string mystring = sw.ToString();
''''''''''''''''''''''''''''''''''''''
'Deserialize
System.IO.StringReader sr = new System.IO.StringReader(mystring);
DataSet ds2 = new DataSet();
ds2.ReadXml(sr);

I thought that this was very simple?

Cor
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top