OO4O and Excel - OO4O and Wizards(Archived)

I have looked at the Excel Sample that comes with the OO4O Installation. It works perfectly and so I wanted to use it in an Excel Spreadsheet that I have. I modified the code so that I would query for one column of information and I wanted that one column of information to be inserted into column AK. Now, when I run the macro, it doesn't work. It will select the column and clear it but it will not insert the code where I need it to. Here is the code:
Sub EmpData()
'Declare variables as objects
Dim OraSession As Object
Dim OraDatabase As Object
Dim EmpDynaset As Object
Dim flds() As Object
Dim fldcount As Integer
Set OraSession = CreateObject("OracleInProcServer.XOraSession")
Set OraDatabase = OraSession.OpenDatabase("PKDEMO", "*****/*****",
0&)
Set EmpDynaset = OraDatabase.CreateDynaset("select CU_NAME from CU",
0&)
Range("AK1:AK50").Select
Selection.ClearContents
'Declare and create an object for each column.
'This will reduce objects references and speed
'up your application.
fldcount = EmpDynaset.Fields.Count
ReDim flds(0 To fldcount - 1)
For Colnum = 0 To fldcount - 1
Set flds(Colnum) = EmpDynaset.Fields(Colnum)
Next
'Insert Column Headings
For Colnum = 0 To EmpDynaset.Fields.Count - 1
ActiveSheet.Cells(1, Colnum + 1) = flds(Colnum).Name
Next
'Display Data
For Rownum = 2 To EmpDynaset.RecordCount + 1
For Colnum = 0 To fldcount - 1
ActiveSheet.Cells(Rownum, Colnum + 1) = flds(Colnum).Value
Next
EmpDynaset.DbMoveNext
Next
Range("AK1:AK1").Select
End Sub
Sub ClearData()
Range("AK1:AK50").Select
Selection.ClearContents
Range("AK1:AK1").Select
End Sub
Can someone help me understand where I'm going wrong? Thanks, Jeremy

Nevermind, I figured it out. Where you see: Colnum + 1, you can change the 1 to any number of rows you want to move over to insert into, so if you want to insert into AK, Colnum + 37, is what you'd code into the macro.

Related

How can I retrieve a LONG data type using ADO

In VB I am using an ADODB object to retrieve data from an Oracle table that has a LONG data type column...
specifically: SELECT TRIGGER_BODY FROM USER_TRIGGERS WHERE TRIGGER_NAME = 'MYTRIGGER'
I have tried using the GETCHUNK method but it only returns the first 150 or so characters no matter how
many times I call it???? here is the sample code I'm using........
Dim Cn As ADODB.Connection, Rs As ADODB.Recordset, SQL As String
Dim sChunk() As Byte
Set Cn = New ADODB.Connection
Set Rs = New ADODB.Recordset
Cn.CursorLocation = adUseServer
Cn.Open "Provider=OraOLEDB.Oracle.1;Password=hrzadmin;Persist Security
Info=True;UserID=hadmin;Data Source=xxx.local"
SQL = "SELECT trigger_body from user_triggers where trigger_name = 'MYTRIGGER'"
Rs.Open SQL, Cn, adOpenStatic, adLockReadOnly
Debug.Print Rs!trigger_name
Debug.Print Rs!trigger_body
sChunk = rs.Fields("trigger_body").GetChunk(500)
Debug.Print sChunk
I have a similar code which works for chunk size >400,
The image I am trying to retrieve is huge so the chunksize is also more.
Did you try with any non meta table?
For your reference I am pasting my application code below.
Hope it helps.
--Jagriti
Private Sub cmdGetImage_Click()
Dim bytchunk() As Byte 'variable to store binary data
Dim destinationFileNum As Integer 'variable for filenumber
'recordset for fetching Product Image for the product selected form the list
Dim recProductImage As New ADODB.Recordset
Dim offset As Long
Dim totalsize As Long
Dim roundTrips As Long
'variables used in calculation of time taken to fetch the image
Dim startTime As Currency, EndTime As Currency, time As Currency, Freq As Currency
Dim i As Integer 'counter variable
i = 0
On Error GoTo ErrorText 'redirect to error handler
'** Step 1 **'
'validating if product is selected from the list
If cboSelectProduct.Text = "" Then
MsgBox "Select product from the list!"
Exit Sub
End If
'** Step 2 **'
'validating if "optChunk" optionbox is selected then
'"txtChunksize" textbox should contain a value
If optchunk.Value = True Then
'validate if chunksize value is null
If txtChunkSize.Text = "" Then
MsgBox "Enter value for chunksize "
Exit Sub
End If
'validating that the chunk size entered should be a positive value
If CInt(txtChunkSize.Text) < 1 Then
MsgBox "ChunkSize value should be positive!"
Exit Sub
End If
End If
'** Step 3 **'
'open image column from product_information table using m_Oracon connection
recProductImage.Open "SELECT product_image FROM product_information " & _
" WHERE product_id =" & cboSelectProduct.ItemData(cboSelectProduct.ListIndex) _
, m_Oracon, adOpenStatic _
, adLockOptimistic, adCmdText
'check if product image exists for the product selected
If Not IsNull(recProductImage!product_image) Then
'setting mouse pointer on the form "frmChunkSize" to wait state
frmChunkSize.MousePointer = vbHourglass
'** Step 4 **'
'assigning "desitinationFileNum" variable to next file number
'available for use
destinationFileNum = FreeFile
'allocates a buffer for I/O to the temporary file "tempImage.bmp"
'at the current application path
Open App.Path & "\tempImage.bmp" For Binary As destinationFileNum
'** Step 5 **'
'Get the frequency of internal timer in Freq variable
QueryPerformanceFrequency Freq
'start the timer
QueryPerformanceCounter startTime
'clear "imgProduct" imagebox
imgProduct.Picture = LoadPicture("")
'** Step 6 **
If optValue.Value = True And optchunk.Value = False Then
'** Step 7 **
'using ADO Value property
bytchunk = recProductImage("product_image").Value
'appending byte arrary data to the temporary file
Put destinationFileNum, , bytchunk
'displaying "No. of Round Trips" in a label to 1
lblRoundTrips = 1
ElseIf optchunk.Value = True Then
'** Step 8 **
'converting the value entered "txtChunkSize" textbox to long
'and assigning it to chunksize variable
m_chunksize = CLng(txtChunkSize.Text)
'assigning the actual size of the image retrieved to a variable
totalsize = recProductImage("product_image").ActualSize
'calculating and assigning the "No. of Round Trips" to a variable
roundTrips = totalsize / m_chunksize
'in case fragment of data left, incrementing roundtrips by 1
If (totalsize Mod m_chunksize) > 0 Then
roundTrips = roundTrips + 1
End If
'In this loop the image is retrieved in terms of chunksize
'and appended to the temporary file
Do While offset < totalsize
'** Step 9 **
'retrieving product_image from the recordset, in chunks of bytes
bytchunk = recProductImage("product_image").GetChunk(m_chunksize)
offset = offset + m_chunksize
'appending byte arrary data to the temporary file
Put destinationFileNum, , bytchunk
Loop
'displaying "No. of Round Trips" in a label
lblRoundTrips = roundTrips
End If
'** Step 10 **'
'stop the timer after image retrieval is done
QueryPerformanceCounter EndTime
'close the opened file handle
Close destinationFileNum
I have a similar code which works for chunk size >400,
The image I am trying to retrieve is huge so the chunksize is also more.
Did you try with any non meta table?
For your reference I am pasting my application code below.
Hope it helps.
--Jagriti
Private Sub cmdGetImage_Click()
Dim bytchunk() As Byte 'variable to store binary data
Dim destinationFileNum As Integer 'variable for filenumber
'recordset for fetching Product Image for the product selected form the list
Dim recProductImage As New ADODB.Recordset
Dim offset As Long
Dim totalsize As Long
Dim roundTrips As Long
'variables used in calculation of time taken to fetch the image
Dim startTime As Currency, EndTime As Currency, time As Currency, Freq As Currency
Dim i As Integer 'counter variable
i = 0
On Error GoTo ErrorText 'redirect to error handler
'** Step 1 **'
'validating if product is selected from the list
If cboSelectProduct.Text = "" Then
MsgBox "Select product from the list!"
Exit Sub
End If
'** Step 2 **'
'validating if "optChunk" optionbox is selected then
'"txtChunksize" textbox should contain a value
If optchunk.Value = True Then
'validate if chunksize value is null
If txtChunkSize.Text = "" Then
MsgBox "Enter value for chunksize "
Exit Sub
End If
'validating that the chunk size entered should be a positive value
If CInt(txtChunkSize.Text) < 1 Then
MsgBox "ChunkSize value should be positive!"
Exit Sub
End If
End If
'** Step 3 **'
'open image column from product_information table using m_Oracon connection
recProductImage.Open "SELECT product_image FROM product_information " & _
" WHERE product_id =" & cboSelectProduct.ItemData(cboSelectProduct.ListIndex) _
, m_Oracon, adOpenStatic _
, adLockOptimistic, adCmdText
'check if product image exists for the product selected
If Not IsNull(recProductImage!product_image) Then
'setting mouse pointer on the form "frmChunkSize" to wait state
frmChunkSize.MousePointer = vbHourglass
'** Step 4 **'
'assigning "desitinationFileNum" variable to next file number
'available for use
destinationFileNum = FreeFile
'allocates a buffer for I/O to the temporary file "tempImage.bmp"
'at the current application path
Open App.Path & "\tempImage.bmp" For Binary As destinationFileNum
'** Step 5 **'
'Get the frequency of internal timer in Freq variable
QueryPerformanceFrequency Freq
'start the timer
QueryPerformanceCounter startTime
'clear "imgProduct" imagebox
imgProduct.Picture = LoadPicture("")
'** Step 6 **
If optValue.Value = True And optchunk.Value = False Then
'** Step 7 **
'using ADO Value property
bytchunk = recProductImage("product_image").Value
'appending byte arrary data to the temporary file
Put destinationFileNum, , bytchunk
'displaying "No. of Round Trips" in a label to 1
lblRoundTrips = 1
ElseIf optchunk.Value = True Then
'** Step 8 **
'converting the value entered "txtChunkSize" textbox to long
'and assigning it to chunksize variable
m_chunksize = CLng(txtChunkSize.Text)
'assigning the actual size of the image retrieved to a variable
totalsize = recProductImage("product_image").ActualSize
'calculating and assigning the "No. of Round Trips" to a variable
roundTrips = totalsize / m_chunksize
'in case fragment of data left, incrementing roundtrips by 1
If (totalsize Mod m_chunksize) > 0 Then
roundTrips = roundTrips + 1
End If
'In this loop the image is retrieved in terms of chunksize
'and appended to the temporary file
Do While offset < totalsize
'** Step 9 **
'retrieving product_image from the recordset, in chunks of bytes
bytchunk = recProductImage("product_image").GetChunk(m_chunksize)
offset = offset + m_chunksize
'appending byte arrary data to the temporary file
Put destinationFileNum, , bytchunk
Loop
'displaying "No. of Round Trips" in a label
lblRoundTrips = roundTrips
End If
'** Step 10 **'
'stop the timer after image retrieval is done
QueryPerformanceCounter EndTime
'close the opened file handle
Close destinationFileNum
I have a similar code which works for chunk size >400,
The image I am trying to retrieve is huge so the chunksize is also more.
Did you try with any non meta table?
For your reference I am pasting my application code below.
Hope it helps.
--Jagriti
Private Sub cmdGetImage_Click()
Dim bytchunk() As Byte 'variable to store binary data
Dim destinationFileNum As Integer 'variable for filenumber
'recordset for fetching Product Image for the product selected form the list
Dim recProductImage As New ADODB.Recordset
Dim offset As Long
Dim totalsize As Long
Dim roundTrips As Long
'variables used in calculation of time taken to fetch the image
Dim startTime As Currency, EndTime As Currency, time As Currency, Freq As Currency
Dim i As Integer 'counter variable
i = 0
On Error GoTo ErrorText 'redirect to error handler
'** Step 1 **'
'validating if product is selected from the list
If cboSelectProduct.Text = "" Then
MsgBox "Select product from the list!"
Exit Sub
End If
'** Step 2 **'
'validating if "optChunk" optionbox is selected then
'"txtChunksize" textbox should contain a value
If optchunk.Value = True Then
'validate if chunksize value is null
If txtChunkSize.Text = "" Then
MsgBox "Enter value for chunksize "
Exit Sub
End If
'validating that the chunk size entered should be a positive value
If CInt(txtChunkSize.Text) < 1 Then
MsgBox "ChunkSize value should be positive!"
Exit Sub
End If
End If
'** Step 3 **'
'open image column from product_information table using m_Oracon connection
recProductImage.Open "SELECT product_image FROM product_information " & _
" WHERE product_id =" & cboSelectProduct.ItemData(cboSelectProduct.ListIndex) _
, m_Oracon, adOpenStatic _
, adLockOptimistic, adCmdText
'check if product image exists for the product selected
If Not IsNull(recProductImage!product_image) Then
'setting mouse pointer on the form "frmChunkSize" to wait state
frmChunkSize.MousePointer = vbHourglass
'** Step 4 **'
'assigning "desitinationFileNum" variable to next file number
'available for use
destinationFileNum = FreeFile
'allocates a buffer for I/O to the temporary file "tempImage.bmp"
'at the current application path
Open App.Path & "\tempImage.bmp" For Binary As destinationFileNum
'** Step 5 **'
'Get the frequency of internal timer in Freq variable
QueryPerformanceFrequency Freq
'start the timer
QueryPerformanceCounter startTime
'clear "imgProduct" imagebox
imgProduct.Picture = LoadPicture("")
'** Step 6 **
If optValue.Value = True And optchunk.Value = False Then
'** Step 7 **
'using ADO Value property
bytchunk = recProductImage("product_image").Value
'appending byte arrary data to the temporary file
Put destinationFileNum, , bytchunk
'displaying "No. of Round Trips" in a label to 1
lblRoundTrips = 1
ElseIf optchunk.Value = True Then
'** Step 8 **
'converting the value entered "txtChunkSize" textbox to long
'and assigning it to chunksize variable
m_chunksize = CLng(txtChunkSize.Text)
'assigning the actual size of the image retrieved to a variable
totalsize = recProductImage("product_image").ActualSize
'calculating and assigning the "No. of Round Trips" to a variable
roundTrips = totalsize / m_chunksize
'in case fragment of data left, incrementing roundtrips by 1
If (totalsize Mod m_chunksize) > 0 Then
roundTrips = roundTrips + 1
End If
'In this loop the image is retrieved in terms of chunksize
'and appended to the temporary file
Do While offset < totalsize
'** Step 9 **
'retrieving product_image from the recordset, in chunks of bytes
bytchunk = recProductImage("product_image").GetChunk(m_chunksize)
offset = offset + m_chunksize
'appending byte arrary data to the temporary file
Put destinationFileNum, , bytchunk
Loop
'displaying "No. of Round Trips" in a label
lblRoundTrips = roundTrips
End If
'** Step 10 **'
'stop the timer after image retrieval is done
QueryPerformanceCounter EndTime
'close the opened file handle
Close destinationFileNum

OracleDataAdapter returning wrong number of columns

Hello All,
I have an issue of an oracle data adapter not returning all columns in my select statement. When I use code similar to below, the data adapter returns 2 columns per row instead of 5. And they are out of order (ie, DataRow(0) could be column 1 and DataRow(1) could be column 4 -- so I don't see which columns have been dropped without looking at the value).
The database id XE on the local machine. The connection works fine. And the internal VS.NET PL/SQL debugger returns the query just fine.
Some of the columns I'm trying to get are null -- in fact, most are. But they are changed during the program. So I still need them to show up in the dataset.
BTW, I have had zero success getting OracleCommand.BindByName and OracleParameters to work, so I punted. Since I can get what I want out of readers and datasets, I can live without'em -- or can I?!?!
I think my problem has something to do with handling null values. So I have tried the select statement with NVL wrapping the fields that could be null. But still no success.
Any ideas?
Table:
account char(30) not null
col_code as NUMBER(1,0) null ok
columnIDontNeed as whatever null ok
sum1 as char(1) null ok
sum2 as char(1) null ok
sum3 as char(1) null ok
anotherColumnIDontNeed as whatever null ok
Sample Code:
dim oconn as New OracleConnection(conStrBldr.toString)
Dim cmdLedger As OracleCommand = oconn.CreateCommand
cmdLedger.BindByName = True ' seems to affect nothing! ever!
cmdLedger.AddToStatementCache = False ' no noticable affect
cmdLedger.CommandText = " SELECT account,col_code,sum1,sum2,sum3 "
cmdLedger.CommandText &= "FROM gl.ledger "
cmdLedger.CommandText &= "ORDER BY gl.ledger.account "
cmdLedger.CommandType = CommandType.Text
' Create DataAdapter based on main Ledger SELECT
Dim cmdLedgerDA As New OracleDataAdapter(cmdLedger)
cmdLedgerDA.ReturnProviderSpecificTypes = True ' same results with False
' Create DataSet and Fill it.
' After this, we can now use this dataset
' to iterate through the GL ledger data.
Dim cmdLedgerDS As New DataSet("GLBal")
Try ' to fill dataset with Ledger SELECT
' fill dataset from OracleDataAdapter and the
' previously defined Oracle Command.
cmdLedgerDA.Fill(cmdLedgerDS, "GL.LEDGER") ' tried with and without src
Catch ex As OracleException
ShowEx(ex)
End Try ' to fill dataset with Ledger SELECT
These are the typical test from within VB that I've run to check what was returned:
console.writeline(cmdLedgerDS.Tables(0).Rows(0).ItemArray.Length)
2
dim row as DataRow = cmdLedgerDS.Tables(0).Rows(0)
console.writeline(row(0).toString & row(1).toString & row(2).toString & row(3).toString & row(4).toString) ' EXCEPTION IS THROWN 
I cannot reproduce the error using basic code below. What is the specific exception you get?
And BindByName is not necessary since you're not using bind variables
Sub Main()
    Dim da As OracleDataAdapter
    Dim sqlstr As String
    Dim connstr As String
    Dim ds As DataSet
    Dim dr As DataRow
    Dim dc As DataColumn
    Try
        sqlstr = "select employee_id, first_name, last_name, null, salary "
        sqlstr &= "from employees where rownum < 10"
        connstr = "Data Source=xe;User ID=hr;Password=hr;"
        da = New OracleDataAdapter(sqlstr, New OracleConnection(connstr))
        ds = New DataSet("EmployeeDS")
        da.Fill(ds, "employees")
        For Each dc In ds.Tables("employees").Columns
            Console.Write(dc.ColumnName & " ")
        Next
        Console.WriteLine()
        For Each dr In ds.Tables("employees").Rows
            Console.WriteLine(dr(0).ToString & " " & _
                dr(1).ToString & " " & dr(2).ToString & " " & _
                dr(3).ToString & " " & dr(4).ToString)
        Next
    Catch ex As Exception
        Console.WriteLine(ex.Message)
    End Try
End SubOutput should look like
EMPLOYEE_ID FIRST_NAME LAST_NAME NULL SALARY
100 Steven King  24000
101 Neena Kochhar  17000
102 Lex De Haan  17000
103 Alexander Hunold  9000
104 Bruce Ernst  6000
105 David Austin  4800
106 Valli Pataballa  4800
107 Diana Lorentz  4200
108 Nancy Greenberg  12000I am using VS2005, ODP 10.2.0.2.21 and OracleXE on remote machine.
NH
Message was edited by:
nurhidayat 
In order to return column you should
Tables(0).Columns.Count
and not
Tables(0).Rows(0).ItemArray.Length
Check this out:
http://msdn2.microsoft.com/en-us/library/system.data.datacolumn.table.aspx
Ming Man 
When I use the database designer instead of manually coding it, I get a little further. It seems to be a VS.NET issue.
Right now I have an oracle adapter, created through Database Designer tools in VS.NET. When I use the adapter within a method, the dataset has the table and 11 columns (as the real code had).
When I pass that resulting dataset to another method and then check it, it has the one table and *7* columns -- as my manually coded SELECTs did.
My workaround is to expand the main method running this process to include the data adapters FILLing of the dataset -- instead of calling a module method outside the form. Now I see 11 columns.
I still think it has something to do with handling NULL fields. When I pass the dataset to another method and see fewer columns than expected, it's the null columns that are gone. Maybe they're just not accessible through ROW(index) method after that.
Not sure... but I'm no longer sweating profusely. ;-)
Thanks.

Cast SDO_ORDINATE VARRAY

Hi all,
I want to access the result of an intersection from two lines via jdbc. Thes SQL-Statement:
select a.geom.SDO_ORDINATES from (
select sdo_geom.sdo_intersection(
a.geometrie,
MDSYS.SDO_GEOMETRY(2002,8220,null,
MDSYS.SDO_ELEM_INFO_ARRAY(1, 2, 1),
MDSYS.SDO_ORDINATE_ARRAY(8.3963,49.5975,8.4037,49.5862)), 0.000005
) as geom
from HWS_GEOMETRIE_LL a where ID_GEOMETRIE = 348
) a;
However, the result is from type SDO_ORDINATE_ARRAY which cannot be accessed by ResultSet.next().
Is ist possible to cast the SDO_ORDINATE_ARRAY to a varchar or any other simple type ??
Thanks Peter 
Peter,
I have accessed the sdo_ordinates array using OO4O for VB like this:
dim OraSession as OraSession
dim OraDatabase as OraDatabase
dim LRS as OraDynset
dim Results as OraDynSet
dim Ordinates as OraCollection
dim sdo_geometry as OraObject
dim i,j as integer
Set OraSession = CreateObject("OracleInProcServer.XOraSession")
Set OraDatabase = OraSession.DbOpenDatabase("DB_NAME","username/password",ORADB_DEFAULT)
Set Results = OraDatabase.CreateDynaset("select pkey_column from VAL_RESULTS",ORADB_DEFAULT)
For i = 1 to Results.RecordCount
Set LRS = OraDatabase.CreateDynaset("select geometry from TABLE where gid = " & Results.Fields("pkey_column").Value.ORADB_DEFAULT)
Set sdo_geometry = LRS.Fields("geometry").Value
Set Ordinates = sdo_geometry.Item("sdo_ordinates").Value
' You can now access sdo_ordinates
For j = 1 to Ordinates.Size
MsgBox Ordinates(j)
Next j
Next i
Hope that helps
Dave
Hello,
You should be able to access any Oracle Structure or Array with a JDBC ResultSet. Just use result.getObject() and cast it to the right type. The returned instance does implement either a java.sql.Struct or java.sql.Array (for oracle specific features look at oracle.sql.STRUCT etc. ).
Bye,
Heiko.

OraField with wrong data type.

Hi there,
I'm having problems using the Oracle Objects for OLE (OO4O)8.1.7.3.11 with Visual Basic 6.0.
Here is the code:
SQL = "select ENAME, HIREDATE, SAL from emp where ename = 'ALLEN'"
Set OraSession = CreateObject("OracleInProcServer.XOraSession")
OraSession.CreateDatabasePool 1, 40, 200, "ExampleDB", "scott/tiger", 0
Set OraDatabase = OraSession.GetDatabaseFromPool(10)
Set OraDynaset = OraDatabase.DbCreateDynaset(SQL, 0)
Print TypeName(OraDynaset("HIREDATE").Value)
Print TypeName(OraDynaset("SAL").Value)
The field 'HIREDATE' comes as DATE type and 'SAL' comes as STRING type.
Here is the data base structure:
HIREDATE     DATE (7) NULL
SAL     NUMBER (7,2) NULL
Why the field 'SAL' comes as STRING type instead of DOUBLE type? How can I fix this?

How to Read-Write BLOB data example

Hi all,
With reference to the example on "How to: Read and Write BLOB Data to a Database Table Through an Anonymous PL/SQL Block" on http://otn.oracle.com/sample_code/tech/windows/odpnet/howto/anonyblock/index.html I have a question and would be really greatful if someone could give me the solution. In the example, it shows the read and write immediately after one another.
****************************************************************************************
' Step 3
' Create Anonymous PL/SQL block string
Dim block As String =
" BEGIN " & _
" INSERT INTO testblob (id, photo) VALUES (100, :1) ;" & _
" SELECT photo into :2 from testblob WHERE id = 100 ;" & _
" end ;"
' Set command to create Anonymous PL/SQL Block
Dim cmd As OracleCommand = New OracleCommand()
cmd.CommandText = block
cmd.Connection = con
' Since executing an anonymous PL/SQL block, setting the command type
' as Text instead of StoredProcedure
cmd.CommandType = CommandType.Text
' Step 4
' Setting Oracle parameters
' Bind the parameter as OracleDbType.Blob
' to command for inserting image
Dim param As OracleParameter = cmd.Parameters.Add("blobtodb", OracleDbType.Blob)
param.Direction = ParameterDirection.Input
****************************************************************************************
These 2 steps establish that Parameters(1) contain the data pertaining to the location of the photo data. This Parameter is then subsequently used IMMEDIATELY afterwards to retrieve the image and store it in a file on the system:
****************************************************************************************
' Step 6
' Save the retrieved image to the DestinationLoc in the file system
' Create a byte array
Dim byteData As Byte()
Dim Paramvalue As OracleBlob
Paramvalue = cmd.Parameters(1).Value
' fetch the value of Oracle parameter into the byte array
byteData = CType((Paramvalue.Value), Byte())
' get the length of the byte array
Dim ArraySize As Integer = New Integer()
ArraySize = byteData.GetUpperBound(0)
****************************************************************************************
What do I need to do, if I need to retrieve this data in another script altogther? I will obviously not have access to "Parameter(1)" and will have to get this data, presumably from the BLOB data stored in the database, ithis case a table called "testblob". I guess my question is, provided I need to do the exact samething, i.e. stream the BLOB data stored inside this table, what would I need to do. The SQL statement would probably look
select photo from testblob where WHERE id = 100;
How do I then get the result into VB .NET environment so that I can display the image as a JPEG?
My apologies if this is rather trivial - I'm very new at this stuf...... Thanks for all your help.

Categories

Resources