hi,
Please check out this code for retrieving the image from the sql server, first get the image field data in a data reader and from there we can convert the data into a BYTE array, using that array the file can be created..
have a look
byte[] file = SqlConvert.ToByteArray(dr["FileImage"]);
string fileName = SetupFileName(SqlConvert.ToString(dr["FileName"]));
string filePath = System.Environment.CurrentDirectory + “\\myFiles\\” + fileName;
FileStream fs = new FileStream(filePath, FileMode.Create, FileAccess.Write);
BinaryWriter bw = new BinaryWriter(fs);
bw.Write(file);
bw.Flush();
bw.Close();
fs.Close();
Happy Coding!!!! :)
Thanks Anil Kumar Pandey System Architect Green Point Technology (India) Ltd. Mumbai, Maharshtra
|
| Author: R.Jaya kumar (JK) 07 Jul 2009 | Member Level: Diamond Points : 1 |
hi
anil
chenage this line vb.net here
Dim file() As Byte = SqlConvert.ToByteArray(dr("FileImage")) Dim fileName As String = SetupFileName(SqlConvert.ToString(dr("FileName")))
|