I have a table with a BLOB column which I need to read when a button is pressed. I am using the following code but getting error (at myStreaM.Write ) as:
Run-time error 3001 - Arguments are of wrong type, are out of acceptable range, or are in conflict with each other.
Code:
Sub BlobTest()
Dim conn As ADODB.Connection
Set conn = New ADODB.Connection
Dim ProdConnectString
ProdConnectString = "provider=msdaora.1;user id=user;password=pass1;data source = dbsource;option=1+2+8+32+2048+16384"
conn.CursorLocation = adUseClient
conn.Open ProdConnectString
Dim rs As ADODB.Recordset
Set rs = New ADODB.Recordset
Dim myStreaM As ADODB.Stream
Set myStreaM = New ADODB.Stream
myStreaM.Type = adTypeBinary
rs.Open "select ATTACHSYSFILENAME from TestTable where ID = '1'", conn, adOpenKeyset, adLockOptimistic
myStreaM.Open
myStreaM.Write (rs.Fields("ATTACHSYSFILENAME").Value)
' mystream.Write rs!ATTACHSYSFILENAME
myStreaM.SaveToFile "c:\temp\readme.txt", adSaveCreateOverWrite
myStreaM.Close
rs.Close
conn.Close
End Sub
Can anyone help me figure out what is wrong or is there anything I need to change? I have added the Microsoft ActiveX data objects 2.7 library.
Thanks.
~BS