Solved

save blob to local variable

Posted on 2009-05-03
2
558 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

Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

Join & Write a Comment

The debugging module of the VB 6 IDE can be accessed by way of the Debug menu item. That menu item can normally be found in the IDE's main menu line as shown in this picture.   There is also a companion Debug Toolbar that looks like the followin…
I was working on a PowerPoint add-in the other day and a client asked me "can you implement a feature which processes a chart when it's pasted into a slide from another deck?". It got me wondering how to hook into built-in ribbon events in Office.
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

757 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