Click here to Skip to main content
16,019,618 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I generate my xml into "variable string str" by using "dataset.GetXml" and then I write the "xml which is contained in variable str" into "file.xml" by using "sFile.WriteLine(str) while 'sFile' is a stream reader"

My reason for using 'writeline' instead of 'dataset.WriteXml' because I need to encrypt the 'xml stored in 'str' before I store it into file.xml.

I got everything fine for the encrypted result, and so does the decrypted result as well.

Here's the decrypted result of my file.xml below (I have checked it the xml value which in str before encryption and which in decrypted file.xml. They are all match well)

------------------------------------------------------------------------

XML
<newdataset>
       <table>
             <title> Book 1 <title/>
             <addby />
             <date>2010-09-22T14:43:00.0000000+07:00</date>
       </table>
</newdataset>


------------------------------------------------------------------------

Here is my plain xml value before it got encrypted or decrypted which I stored it in variable str by using GetXml. I don't know for sure but my xml value doesn't contain declaration "" like common xml used to have.

All the xml file which I got from GetXml is just like below (No declaration like
XML
)

<newdataset>
       <table>
             <title> Book 1 <title/>
             <addby />
             <date>2010-09-22T14:43:00.0000000+07:00</date>
       </table>
</newdataset>




-------------------------------------------------------------------------


And since I think it may not cause any problem then I keep coding and decrypt it which is going well and the decrypted result is perfectly same ofcourse.

My problem is, when I try to make my xml value show in Data GridView by using the code below, and run the debug, it prompt an error said "could not find the file c:\bla\File.xml ". Please help and thanks for any reviewing or suggestion too.

ds = New DataSet
path = System.IO.Path.GetFullPath(strFileToDecrypt)
ds.ReadXml(path)
DGV.DataSource = ds


(strFileToDecrypt is string which stored ".FileName" from SaveFileDialog)


UPDATE:
Solved by OP himself. Posted as an answer.
Posted
Updated 10-Feb-11 21:17pm
v3
Comments
sen pao 10-Feb-11 23:31pm    
Finally, I got my own working path worked.^^
You know, since I changed the name of the xml file after encryption, I forget to use the same name for decryption. But know I got it. I called it a day.^^

1 solution

After, I hurry in my effort, I got my own solving way which really working good.
I never think to answer it mayself until I make a message box this is it just now and I got the answer hore.

My problem just in the path and here's my code which worked.
xmlDatadoc = New XmlDataDocument
path = System.IO.Path.GetFullPath(pk)
MsgBox("Ini Dia" & path)
xmlDatadoc.DataSet.ReadXml(path)
ds = New DataSet
ds = xmlDatadoc.DataSet
DGV.DataSource = ds.DefaultViewManager


Happy to solve it.^^
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900