How to read a image of Database?

  • Thread starter Thread starter Dexter
  • Start date Start date
D

Dexter

Hello all,
i need to read a image of a SQL Server database, and to show in the
CrystalReport.
Somebody know how to do this?


Thanks.

Dexter
 
Hi Dexter,

In order to reading BLOB data from database, it's better
use CommandBehavior.SequentialAccess enumerated value.
Command.ComandText = "Select Image_Date From Data_Table";
Using(SqlDataReader reader = command.ExecuteReader
(CommandBehavior.SequentialAccess)){
While (reader.Read(){
long size = reader.GetBytes(0, 0, null, 0, 0);
byte[] data = new byte[size];
long byteread = 0;
int pos = 0;
while (byteread < size){
byteread += reader.GetBytes(0, pos, data, pos,
chunkSize);
pos += chunkSize;
}
}
}


Elton
(e-mail address removed)
 
Back
Top