Solved

save blob to local variable

Posted on 2009-05-03
2
562 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

Enroll in May's Course of the Month

May’s Course of the Month is now available! Experts Exchange’s Premium Members and Team Accounts have access to a complimentary course each month as part of their membership—an extra way to increase training and boost professional development.

Question has a verified solution.

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

Background What I'm presenting in this article is the result of 2 conditions in my work area: We have a SQL Server production environment but no development or test environment; andWe have an MS Access front end using tables in SQL Server but we a…
You can of course define an array to hold data that is of a particular type like an array of Strings to hold customer names or an array of Doubles to hold customer sales, but what do you do if you want to coordinate that data? This article describes…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
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…

734 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