How can store image file in sql server through C# coding?
Sunil Kumar Gautam
(Select Image file (bmp, jpg).....
Requirement:- pictuebox, 3 buttons
-------------------------------------
private
{OpenFileDialog opnFileBoxImage =
{strBLOBFilePath = opnFileBoxImage.FileName;
pictureBox1.Image = Image.FromFile(strBLOBFilePath);
}}
==================================================
(Save Image file in to SQL server)
note :- ( create table imageTable (empid int, img image))
{
=========================================
(retreive image from SQL server)
(button click)
sqlconnection con = new sqlconnection(connectionPath); sqlcommand cmd1 = new sqlcommand("Select img from imageTable", con); sqldataadapter da = new sqldataadapter(cmd1); dataset ds = new dataset(); da.fill(ds, "ima"); byte[] bytes = ((Bytes)(ds.tables(0).rows(0)(0))); memortstream ms = new memortstream(bytes); picturebox1.image = picturebox1.image.fromstream(ms); picturebox1.refresh();