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 7662879
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T13:54:48+00:00 2026-05-31T13:54:48+00:00

I didn’t make the image into binary form, but want to get that image

  • 0

I didn’t make the image into binary form, but want to get that image data from database now.
So can you give so idea about that.
I have done like below to insert image:

FileDialog dialog = new OpenFileDialog();
dialog.InitialDirectory = @":D\";
dialog.Filter = "(*.jpg;*.gif;*.jpeg;*.bmp)| *.jpg; *.gif; *.jpeg; *.bmp";
if (dialog.ShowDialog() == DialogResult.OK)
{
    imagename = dialog.FileName;
    pictureBox1.Image = Image.FromFile(imagename);
}
dialog = null;

Then it also store in database but now I have to retrive the image in next form how can I do?

  • 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-31T13:54:50+00:00Added an answer on May 31, 2026 at 1:54 pm
        int O_id =Convert.ToInt32(textBox2.Text);
    
                SqlConnection cn = new SqlConnection(strCn);
                SqlCommand cmd = new SqlCommand("INSERT INTO BLOBTest (BLOBData, O_id) VALUES (@BLOBData,'"+O_id+"')", cn);
                String strBLOBFilePath = textBox1.Text;//Modify this path as needed.
    
    
                //Read jpg into file stream, and from there into Byte array.
                FileStream fsBLOBFile = new FileStream(strBLOBFilePath, FileMode.Open, FileAccess.Read);
                Byte[] bytBLOBData = new Byte[fsBLOBFile.Length];
                fsBLOBFile.Read(bytBLOBData, 0, bytBLOBData.Length);
                fsBLOBFile.Close();
    
                //Create parameter for insert command and add to SqlCommand object.
                SqlParameter prm = new SqlParameter("@BLOBData", SqlDbType.VarBinary, bytBLOBData.Length, ParameterDirection.Input, false,
                            0, 0, null, DataRowVersion.Current, bytBLOBData);
                cmd.Parameters.Add(prm);
    
                //Open connection, execute query, and close connection.
                cn.Open();
                cmd.ExecuteNonQuery();
                MessageBox.Show("Picture has been uploaded");
                cn.Close();
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I didn't want to make the title too long but this question specifically refers
I didn't attend PDC 2008, but I heard some news that C# 4.0 is
Concepts didn't make the C++0x standard, but Boost still provides The Boost Concept Check
I didn't get any overlay change when my teammates make changes or add a
(Didn't mean to create a new question, but revised the old one enough that
I didn't get any responses from the asp.net forum, so I thought I'd try
I didn't expect this is that complex. But I can't figure out how I
Didn't find any from their website. I mostly just trying to see which one
I didn't get the answer to this anywhere. What is the runtime complexity of
I didn't design this table, and I would redesign it if I could, but

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.