Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 199043
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T16:59:22+00:00 2026-05-11T16:59:22+00:00

I want to take a file from disk and upload it into an Oracle

  • 0

I want to take a file from disk and upload it into an Oracle BLOB field, using VB6. How can I do that?

  • 1 1 Answer
  • 1 View
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-11T16:59:22+00:00Added an answer on May 11, 2026 at 4:59 pm

    Answering my own question, for reference:

    Public Function SaveFileAsBlob(fullFileName As String, documentDescription As String) As Boolean
    
        'Upload a binary file into the database as a BLOB
        'Based on this example: http://www.codeguru.com/forum/printthread.php?t=337027
    
        Dim rstUpload As ADODB.Recordset
        Dim pkValue AS Long
        On Error GoTo ErrorHandler
    
        Screen.MousePointer = vbHourglass        
    
        'Create a new record (but leave document blank- we will update the doc in a moment)
        'the where clause ensures *no* result set; we only want the structure
        strSQL = "SELECT DOC_NUMBER, DOC_DESC, BLOB_FIELD " & _
          " FROM MY_TABLE " & _
          " WHERE PRIMARY_KEY = 0" 
        pkValue = GetNextPKValue
    
        Set rstUpload = New ADODB.Recordset
        With rstUpload
          .CursorType = adOpenKeyset
          .LockType = adLockOptimistic
          .Open strSQL, myConn
          .AddNew Array("DOC_NUMBER", "DOC_DESC"), _
                  Array(pkValue, documentDescription)
          .Close
        End With
    
        'They may have the document open in an external application.  Create a copy and work with that copy
        Dim tmpFileName As String
        tmpFileName = GetTempPath & ExtractFileName(fullFileName)
        'if the tmp file exists, delete it
        If Len(Dir(tmpFileName)) > 0 Then
          Kill tmpFileName
        End If
    
        'see this URL for info about this subroutine:
        'http://stackoverflow.com/questions/848087/how-can-i-copy-an-open-file-using-vb6
        CopyFileEvenIfOpen fullFileName, tmpFileName
    
        'Now that our record is inserted, update it with the file from disk
        Set rstUpload = Nothing
        Set rstUpload = New ADODB.Recordset
        Dim st As ADODB.Stream
        rstUpload.Open "SELECT BLOB_FIELD FROM MY_TABLE WHERE PRIMARY_KEY = " & pkValue
          , myConn, adOpenDynamic, adLockOptimistic
        Set st = New ADODB.Stream
        st.Type = adTypeBinary
        st.Open
        st.LoadFromFile (tmpFileName)
        rstUpload.Fields("BLOB_FIELD").Value = st.Read
        rstUpload.Update
    
        'Now delete the temp file we created
        Kill (tmpFileName)
    
        DocAdd = True
    ExitPoint:
        On Error Resume Next
        rstUpload.Close
        st.Close
        Set rstUpload = Nothing
        Set st = Nothing
        Screen.MousePointer = vbDefault
        Exit Function
    ErrorHandler:
        DocAdd = False
        Screen.MousePointer = vbDefault
        MsgBox "Source: " & Err.Source & vbCrLf & "Number: " & Err.Number & vbCrLf & Err.Description, vbCritical, _
             "DocAdd Error"
        Resume ExitPoint
    End Function
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Hallo I want to make an file upload. The script should take the image,
I want to decompile iOS Twitter framework, if fact I take twitterd file from
I want to take database backup from server PC to client PC. I can
I want to take an XML file and replace an element's value. For example
I want to take html, including the text and images and turn it into
I want to take advantage of the new features in Windows 7 using C#
I want to take an array and use that array's values to populate an
I want to take a snapshot with my webcam using java and save it
Take VirtualBox's virtual disk as example :if VirtualBox didn't avoid the buffer mechanism from
A have created a pdf file from an .aspx page using the wkhtmltopdf converter.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.