1

I am using MySQL, I stored my images as varchar in the database, how can I display those images? Any help is appreciated.

My code:

public static DataTable GetAllMydetails()
{
    string connString = "Server=localhost;database=test;uid=root;";
    string query = "SELECT `Mydetails`.`Image`";

    MySqlDataAdapter ma = new MySqlDataAdapter(query, connString);

    DataSet DS = new DataSet();
    ma.Fill(DS);

    return DS.Tables[0];    
}

protected void Page_Load(object sender, EventArgs e)
{
   // I want to display image here on page load...//
}
1
  • Store images in database is usually more expensive than stores in the file storage. The usual approach is store the images paths in the database rather than the image. Commented Oct 2, 2015 at 11:27

1 Answer 1

0

How could you store that image in varchar? Means you stored image name or converted into bytes and then stored?

Because we can't directly store image without using image data type.

So can you please be brief?

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.