3
Answers

how to insert image in sql server 2008 in .net?

Hardik Patel

Hardik Patel

11y
1.1k
1
how to insert image in sql server 2008 in .net?

i am using below code


string str;
FileUpload img = (FileUpload)imgUpload;
            Byte[] imgByte = null;
            if (img.HasFile && img.PostedFile != null)
            {
                HttpPostedFile File = imgUpload.PostedFile;
                imgByte = new Byte[File.ContentLength];
                File.InputStream.Read(imgByte, 0, File.ContentLength);
        

    }
str ="Insert into tblimg values ('"+imgByte.tostring()+"')";



it's not working
Answers (3)