PC Review


Reply
Thread Tools Rate Thread

How can I read the Binary data from DataBase

 
 
Husam
Guest
Posts: n/a
 
      24th Dec 2007
Hi EveryBody:

I have probelm that I hung with for three weeks, My problem is I want to
read Binary data from database. I will told you what I did :

first I declear an array byte and I cast the value in the database to byte
after that I use memory stream then I read the value by using method
FromMemoryStream that In Image class to finally but my pic In PictuerBox.

My code is lookslike the following:

Dim pic() as Byte=Ctype(myreader.getvalue(1),Byte())

myreader is the data reder that I used to read my data from database.

dim ms as new memorystream(pic)

with PictureBox1
..Image=Image.FromMemoryStrem(ms)
End with
But the probelm is I getthe length of pic() 0 thatmena there is no value.

I tried Alot of method and see alot Of Articals In reading blob or Binary
data from database but non were useful

So is thereany body can help me in this issue or direct me to any where to
do so?
 
Reply With Quote
 
 
 
 
Raghu
Guest
Posts: n/a
 
      26th Dec 2007
Hi,
Try this I am using this for reading the BLOB data it might work for you

Dim BTImage() As Byte

BTImage = lsDs.Tables(0).Rows.Item(0).Item("DOC_CONTENT")
lsDS is dataset, change DOC_CONTENT to your column name

then assign the BTImage to the picturebox

in my case I having document I am converting the binary to ASCII I am able
to display the large text with image

picturebox1.image = System.Text.Encoding.ASCII.GetString(BTImage, 0,
BTImage.Length)

you can try this also

Thanks
Raghu


"Husam" wrote:

> Hi EveryBody:
>
> I have probelm that I hung with for three weeks, My problem is I want to
> read Binary data from database. I will told you what I did :
>
> first I declear an array byte and I cast the value in the database to byte
> after that I use memory stream then I read the value by using method
> FromMemoryStream that In Image class to finally but my pic In PictuerBox.
>
> My code is lookslike the following:
>
> Dim pic() as Byte=Ctype(myreader.getvalue(1),Byte())
>
> myreader is the data reder that I used to read my data from database.
>
> dim ms as new memorystream(pic)
>
> with PictureBox1
> .Image=Image.FromMemoryStrem(ms)
> End with
> But the probelm is I getthe length of pic() 0 thatmena there is no value.
>
> I tried Alot of method and see alot Of Articals In reading blob or Binary
> data from database but non were useful
>
> So is thereany body can help me in this issue or direct me to any where to
> do so?

 
Reply With Quote
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Read Binary Database File eselk2003@gmail.com Microsoft Excel Programming 7 9th Feb 2009 06:25 PM
How Can I read the Binary data from Database Husam Microsoft ASP .NET 1 25th Dec 2007 02:43 PM
How can I read Binary data from database Husam Microsoft VB .NET 1 25th Dec 2007 08:04 AM
How to change binary data buffer read from a binary file to string format Anderson Microsoft VC .NET 1 21st Jul 2006 11:35 AM
Binary data stored in SQL Server: can't read from ASP.NET, *can* read from Access? Doug Microsoft ASP .NET 3 4th Nov 2005 07:35 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 06:13 PM.