Retrieve Images from sql server database

后端 未结 4 1894
眼角桃花
眼角桃花 2020-12-04 03:24

i am storing images to the database. How to retrieve all the images from the database.

Eg: select images from imagetable

Problem:

Data Logic:

4条回答
  •  感情败类
    2020-12-04 03:40

    this is an example from Sql Server

            connection.Open();
            SqlCommand command1 = new SqlCommand("select imgfile from myimages where imgname=@param", connection);
            SqlParameter myparam = command1.Parameters.Add("@param", SqlDbType.NVarChar, 30);
            myparam.Value = txtimgname.Text;
            byte[] img = (byte[])command1.ExecuteScalar();
            MemoryStream str = new MemoryStream();
            str.Write(img, 0, img.Length);
            Bitmap bit = new Bitmap(str);
            connection.Close();
    

    look here http://www.akadia.com/services/dotnet_read_write_blob.html

提交回复
热议问题