Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7515129
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T00:42:20+00:00 2026-05-30T00:42:20+00:00

I have a data table in SQL 2008 R2 which is used to store

  • 0

I have a data table in SQL 2008 R2 which is used to store images. There is one column for uploaded image data whose SQL data type is “Image”

On the asp.NET layer I pull data into a dataset and then call GetXml() to get an XML string and then put the xml into a text file for import/export.

The image data is serialized into text but I can’t figure out how it’s encoded.

Original image data in the table: 0x89504E….
Image data in my XML string: iVBORw0KGgo…

I need to recover the String representation of the original 0x89504E…. and I assume that’s HEX. What encoding is the iVBORw0KGgo… ? I can’t find the info anywhere.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-30T00:42:23+00:00Added an answer on May 30, 2026 at 12:42 am

    The encoding is base64.

    The following code takes some binary data, puts it in a DataSet, runs GetXml(), and decodes the string in the XML as base64:

    // Create a DataSet, DataTable, and define a binary column
    DataSet dataSet = new DataSet("dataSet");
    DataTable table = dataSet.Tables.Add("Items");
    table.Columns.Add("image", typeof(byte[]));
    
    /// Add one row of binary data (creating fake binary data from a string)
    byte[] testData = new ASCIIEncoding().GetBytes("StackOverflow");
    Console.WriteLine("Test data: " + new ASCIIEncoding().GetString(testData));
    DataRow row = table.NewRow();
    row["image"] = testData;
    table.Rows.Add(row);
    
    // Convert to XML and fetch the XML representation of the binary data
    string xml = dataSet.GetXml();
    XmlDocument doc = new XmlDocument();
    doc.LoadXml(xml);
    string xmlImageData = doc.SelectSingleNode("//image").InnerText;
    Console.WriteLine("XML data: " + xmlImageData);
    
    // base64decode the XML data and print its value
    byte[] decoded = Convert.FromBase64String(xmlImageData);
    Console.WriteLine("Decoded data: " + new ASCIIEncoding().GetString(decoded));
    

    Output:

    Test data: StackOverflow
    XML data: U3RhY2tPdmVyZmxvdw==
    Decoded data: StackOverflow
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a database table in Sql Server 2008 R2 which contains data stored
I have a sql table which have the following data, Id City Country ---
I have an image data type in my table. When I query using SQL
I have a SQL Server 2008 table which contains an external user reference currently
I have the following code in one of my Sql (2008) Stored Procs which
In SQL Server 2008, I have a strongly typed data set with a table:
We have a SQL server 2008 and one of the tables, say table A
Is there a query in SQL Server 2008 which will delete data from all
I have a Microsoft SQL Server 2008 query that returns data from three tables
In my SQL Server database schema I have a data table with a date

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.