Hello My Friends,

I have a question...
How can i add a photo/picture into SQL Server 2000....?

Need advice please.

Hi Fauzan

The short answer is "you can't" as SQL only handles text, not images.

You can however create a table in SQL where you put the links to all the image files. Then in your report you can link the data that you want with that text link. You then take that text output from SQL, and through the formatting of your report you can use that retrieved link to load the picture.

Hi Fauzan

The short answer is "you can't" as SQL only handles text, not images.

You can however create a table in SQL where you put the links to all the image files. Then in your report you can link the data that you want with that text link. You then take that text output from SQL, and through the formatting of your report you can use that retrieved link to load the picture.

You really should follow up with that the long answer is that you can but this is the preferred method by many, that is just to store the path to the file in the database and not the file itself. And just for you information there are a couple of ways to do it.

OP. Use the Data Form Wizard, which you will find under Add-Ins>Add-In Manager and use the ODBC option which means before you use it you will have to create an ODBC DSN. Use each form option in combination with code/class/control and save project for future use. Then once you are ready to go to a DNS Less connection see http://www.connectionstrings.com


Good Luck

hi friend you can easily save an photo and image to the database. check out this code

 private void button1_Click(object sender, EventArgs e)
        {

            OpenFileDialog dlg = new OpenFileDialog();

            dlg.Title = "Open Photo";

            if (dlg.ShowDialog() == DialogResult.OK)
            {
                try
                {
                    pictureBox1.Image = new Bitmap(dlg.OpenFile());

                    name = dlg.FileName;
                    txtname.Text = dlg.SafeFileName;
                }
                catch (Exception ex)
                {
                    MessageBox.Show("Unable to load file: " + ex.Message);
                }
            }

            dlg.Dispose();
        }

Edited 3 Years Ago by mike_2000_17: Fixed formatting

This article has been dead for over six months. Start a new discussion instead.