Hi Guys,
I have an xml file contains the imagedata attribute. now while reading xml file using dataset i was setting this field to string and insert it to another table that have also image field.
when i am tring to retrive this image it's not a actual image.


Thanks in advance.

Do you mean after you decode the base-64 text it's still not an image? It looks like the start of a JPEG file, and you get "CREATOR: gd-jpeg v1.0 (using IJG JPEG v62), default quality" in the decoded text, but there's nothing after that.

Hi gusano79,
let me explain in detail whats happen

I have a table name Table1 contains img field which is Image datatype. I have store a image in Table1 Now using dataset i have created xml file.

Now i am reading this file with dataset.Readxml() method and inserted image as a string (i think here i am going wrong) in Table2.

Here is my code snippets

Creating XML File

DataSet ds = new DataSet();
            string strxml = "select * from testing123";
            da = new SqlDataAdapter(strxml, connect.getConnection());
            da.Fill(ds, "testing123");
            ds.WriteXml(Application.StartupPath + "\\ImageFile.xml");

Now read this file and insert to table2

string ImageTxt = "";
            DataSet ds = new DataSet();
            ds.ReadXml(Application.StartupPath + "\\ImageFile.xml");
            for (int i = 0; i <= ds.Tables[0].Rows.Count-1; i++)
                ImageTxt = ds.Tables[0].Rows[i][0].ToString();

            string strUpdate = "update paper_setting set imagedata='"+ ImageTxt +"'";
            cmd = new SqlCommand(strUpdate, connect.getConnection());

but when i retrieve image from table2. It's not in proper format.

Any help would be appreciated.

How are you storing the image in the testing123 table?