Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

save blob to local variable

Posted on 2009-05-03
2
Medium Priority
?
564 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 2000 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

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

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

When trying to find the cause of a problem in VBA or VB6 it's often valuable to know what procedures were executed prior to the error. You can use the Call Stack for that but it is often inadequate because it may show procedures you aren't intereste…
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…
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…
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…
Suggested Courses

721 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