Solved

save blob to local variable

Posted on 2009-05-03
2
559 Views
Last Modified: 2012-06-27
I've retrieved data using a datareader and some of the columns are blobs. While I'm reading the records I want to put the blobs in local variables to use them as parameters later when I insert them into another database. Currently I'm writing the blobs to pictures and then read them back in when I need them... for some cases this is good and others I want to just store them.How would I store them as just a local variable
0
Comment
Question by:cobolinx1
2 Comments
 
LVL 6

Expert Comment

by:M3mph15
ID: 24292155
Hi,

You can write the data from the datareader into variable like this:

Datareader.Read()

String strData = Datareader.GetValue([index]).toString() 'index starts at 0 for the first item.

Is this a web application or a stand alone windows application.

HTH
-M3mph15
0
 
LVL 15

Accepted Solution

by:
oobayly earned 500 total points
ID: 24296448
A Blob should be returned as Byte Array, so assuming you're using the SqlClient:
Dim reader As SqlDataReader = comm.ExecuteReader()

Dim blob As Byte() = Nothing

If (reader.Read()) Then

  blob = CType(reader("fldBlob"), GetType(Byte()))

End If

Open in new window

0

Featured Post

DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

If you have ever used Microsoft Word then you know that it has a good spell checker and it may have occurred to you that the ability to check spelling might be a nice piece of functionality to add to certain applications of yours. Well the code that…
When designing a form there are several BorderStyles to choose from, all of which can be classified as either 'Fixed' or 'Sizable' and I'd guess that 'Fixed Single' or one of the other fixed types is the most popular choice. I assume it's the most p…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…

864 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

21 Experts available now in Live!

Get 1:1 Help Now