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)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top