473,563 Members | 2,703 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

How Can I read the Binary data from Database

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
FromMemoryStrea m that In Image class to finally but my pic In PictuerBox.

My code is lookslike the following:

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

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

dim ms as new memorystream(pi c)

with PictureBox1
..Image=Image.F romMemoryStrem( 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?
Dec 24 '07 #1
1 1821
Dim pic as Byte() <-- byte ARRAY, not Byte <-- single byte.
-- Peter
Site: http://www.eggheadcafe.com
UnBlog: http://petesbloggerama.blogspot.com
MetaFinder: http://www.blogmetafinder.com
"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
FromMemoryStrea m that In Image class to finally but my pic In PictuerBox.

My code is lookslike the following:

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

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

dim ms as new memorystream(pi c)

with PictureBox1
.Image=Image.Fr omMemoryStrem(m s)
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?
Dec 25 '07 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
21900
by: Thierry | last post by:
Hello, I do have a mysql database with a BLOB column. What is the proprest way to read this column ? Thx, Thierry
1
5232
by: guyv | last post by:
Hello! I wanna read binary data from database with ADODB.Stream object. So I wrote code.. --------- <% query = "SELECT * FROM Categories" adoDB.DefaultDatabase = "Northwind"
3
2466
by: Doug | last post by:
Working on converting an Access front-end/SQL Server back-end to a .NET front/SQL Server back-end. We are also redesiging the SQL Server database. We have many Word/Excel documents that have been stored as OLE Objects in the old SQL Server database. We can move them over to the new database okay. We can "read" the files okay when...
3
18956
by: nicolasg | last post by:
Hi, I'm trying to open a file (any file) in binary mode and save it inside a new text file. After that I want to read the source from the text file and save it back to the disk with its original form. The problem is tha the binary source that I extract from the text file seems to be diferent from the source I saved. Here is my code: 1)...
3
2931
by: =?Utf-8?B?ZGF2aWQ=?= | last post by:
I try to follow Steve's paper to build a database, and store a small text file into SQL Server database and retrieve it later. Only difference between my table and Steve's table is that I use NTEXT datatype for the file instead of using IMAGE datatype. I can not use SqlDataReader to read the data. I need your help, Thanks. -David (1) I...
14
5748
by: Zoro | last post by:
My task is to read html files from disk and save them onto SQL Server database field. I have created an nvarchar(max) field to hold them. The problem is that some characters, particularly html entities, and French/German special characters are lost and/or replaced by a question mark. This is really frustrating. I have tried using StreamReader...
4
2708
by: programmer27 | last post by:
i've been reading this binary files in this database still no luck. it's not an ordinary binary file. coz there's no file you can see, it's all in the database. i'll attach here the database RanGame1. see the UserInven table -->UserInven having a binary data like this <binary data> i would like to read this. this displays when i'm reading it...
4
7222
by: =?ISO-8859-1?Q?Hans_M=FCller?= | last post by:
Good morning folks, I cannot read a binary file into a mysql database. Everything I tried did not succeed. What I tried (found from various google lookups...) is this: con = MySQLdb.connect(to server) cur = con.cursor() cur.execute("insert into data values('file1', %s)", (open("test.jpg", "rb").read(), ))
1
6707
by: =?Utf-8?B?SHVzYW0=?= | last post by:
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...
0
7659
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7580
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
7882
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
8103
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
0
6244
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
1
5481
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
5208
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3634
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
0
916
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.