Exporting the table to xml :
Expand|Select|Wrap|Line Numbers
- FileStream fs = new FileStream(filename,FileMode.Create,FileAccess.Write,FileShare.None);
- StreamWriter sw = new StreamWriter(fs,Encoding.ASCII);
- ds.WriteXml(sw); //write the xml from the dataset ds
Importing the xml to the dataset :
Expand|Select|Wrap|Line Numbers
- FileStream fs = new FileStream(filename,FileMode.Open);
- DataSet ds = new DataSet();
- ds.ReadXml(fs);
Expand|Select|Wrap|Line Numbers
- ...
- int count = ds.Tables[0].Rows.Count;
- for(int i=0;i<count;i++)
- {
- DataRow myDR = ds.Tables[0].Rows[i];
- ...
- byte[] myphoto = null;
- if(myDR["myphoto"].ToString().Length > 0)
- {
- myphoto = Encoding.ASCII.GetBytes(myDR["myphoto"].ToString().ToCharArray());
- }
- //insert the data to the mysql table
- ...
- }
- ...
sorry for my bad english.