Updating Record (via stored proc) with Blob Field using VB6

Updating Record (via stored proc) with Blob Field using VB6

Post by FS » Wed, 26 Jun 2002 09:05:26

I am trying to update a sqlserver record with a blob field using vb6.
I have the same functionality working with VB.net at this point and it works
All vb6 based samples I have looked at do not allow using the stored proc in
a similar fashion.
I would like to use the same stored proc from VB6 to add the record.
Please find below the code that I have working in VB.net.

I am looking for a similar approach (via same stored proc) using VB6.

Thank you in advance.


       Public Function Add_Recording(ByVal txtUserID As String, ByVal
SourceFilePath As String, ByVal longRecordingTime As Long) As Boolean
            Dim cn As New
            Dim cmd As New SqlCommand("AddRecording", cn)
            ' Mark the Command as a SPROC
            cmd.CommandType = CommandType.StoredProcedure

            Dim fs As New System.IO.FileStream(SourceFilePath,
IO.FileMode.Open, IO.FileAccess.Read)
            Dim b(fs.Length() - 1) As Byte

                fs.Read(b, 0, b.Length)
                Return False
            End Try

            ' Add Parameters to SPROC

SqlDbType.NVarChar, 20)
            parameterUserID.Value = txtUserID

            'BLOB OBJECT
            Dim parameterBlobObject As New

            parameterBlobObject.Value = b

            ' Add SECONDS Parameters to SPROC
            Dim parameterSeconds As New

            parameterSeconds.Value = longRecordingTime

            ' Add file size Parameters to SPROC

SqlDbType.BigInt, 64)
            parameterSize.Value = b.Length

                Return False
            End Try

            Return True

        End Function


Updating Record (via stored proc) with Blob Field using VB6

Post by Sukesh Hooga » Thu, 27 Jun 2002 13:36:45


1) Instead of


one has  has to use, as there is no ADD method for a parameter object in ADO
2.5  for VB6 (Not sure about VB.net)


In case of BLOBs, you will have to use


2) You can try like this

adVarBinary,adParamInput, Size)

To retrieve you will have to use GetChunk method.

You can do the above  in smaller pieces of SomeLargeData




1. Insert/Updated to Image fields via Stored Proc

I have been experimenting with persisting a COM object's properties in a
image field using SQL Server 6.5. I have been sucessful, but only via ADO
AppendChunk() method. I was wondering if there is a way to pass this binary
data in via a stored procedure, instead of actually creating a recordset and
doing it via ADO AppendChunk(). It's not as simple as creating a parameter
of type image and passing in the variant data from my program is it? Thanks
in advance for any help!


2. Question regarding JDBC

3. Saving TMemo field data to a Blob field (Interbase Table) via SQL Update Query

4. dos client for nt 4.0

5. Using BLOBs (Byte) in VB6 via OLE DB to IDS 7.30

6. Oracle PL/SQL, Forms Developer, Airline Systems, UK

7. calling stored proc from stored proc via variable

8. HELP HELP HELP! Simple PL/SQL Problem !!!!?????

9. My textarea form field will not update my stored proc text field

10. Updating BLOB fields via SQL

11. Table Update Via Text File (DTS, Stored Proc, ActiveX, VBScript)

12. Storing BLOB fields via TQuery

13. Using a stored proc to call another stored proc