Upload files to mysql using visual basic

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • vanita01
    New Member
    • Feb 2008
    • 3

    Upload files to mysql using visual basic

    Can any one help me?

    I would like to upload a text/doc file from my visual basic form on to my sql database.
  • debasisdas
    Recognized Expert Expert
    • Dec 2006
    • 8119

    #2
    Do you want to upload the file or store only the path ?

    To store the file convert the file into byte stream and store in database.

    Comment

    • vanita01
      New Member
      • Feb 2008
      • 3

      #3
      Hi

      Thanks for your reply.

      I would like to store the file on to the database. How can I code it in visual basic to store it as byte stream. This is the code I have to browse for the directory. I would also like the code to allow me to seelct files not the whole directory.

      Private Sub Command1_Click( )
      'Opens a Treeview control that displays the directories in a computer
      Command1.Visibl e = True

      Dim lpIDList As Long
      Dim sBuffer As String
      Dim szTitle As String
      Dim tBrowseInfo As BrowseInfo

      szTitle = "File to Upload:"
      With tBrowseInfo
      .hWndOwner = Me.hWnd
      .lpszTitle = lstrcat(szTitle , "")
      .ulFlags = BIF_RETURNONLYF SDIRS + BIF_DONTGOBELOW DOMAIN
      End With

      lpIDList = SHBrowseForFold er(tBrowseInfo)

      If (lpIDList) Then
      sBuffer = Space(MAX_PATH)
      SHGetPathFromID List lpIDList, sBuffer
      sBuffer = Left(sBuffer, InStr(sBuffer, vbNullChar) - 1)

      'Text1.Text = sBuffer
      txtFields(14).T ext = sBuffer
      MsgBox sBuffer
      End If




      End Sub

      Comment

      Working...