Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. .NET (Core and Framework)
  4. How to Save/Load Files like Pictures in/from Database

How to Save/Load Files like Pictures in/from Database

Scheduled Pinned Locked Moved .NET (Core and Framework)
databasetutorial
4 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • I Offline
    I Offline
    ICEFLOWER2
    wrote on last edited by
    #1

    How to Save/Load Files like Pictures in/from Database:confused:

    L Z 2 Replies Last reply
    0
    • I ICEFLOWER2

      How to Save/Load Files like Pictures in/from Database:confused:

      L Offline
      L Offline
      Lost User
      wrote on last edited by
      #2

      Choose the appropriate data type[^].

      speaking as ...

      I 1 Reply Last reply
      0
      • L Lost User

        Choose the appropriate data type[^].

        speaking as ...

        I Offline
        I Offline
        ICEFLOWER2
        wrote on last edited by
        #3

        Thank you body :rose:

        1 Reply Last reply
        0
        • I ICEFLOWER2

          How to Save/Load Files like Pictures in/from Database:confused:

          Z Offline
          Z Offline
          ZappaDog
          wrote on last edited by
          #4

          'Save Dim ms As New MemoryStream PictureBox1.Image.Save(ms, PictureBox1.Image.RawFormat) Dim strType As String = ToolStripStatusLabel1.Text.Substring(ToolStripStatusLabel1.Text.LastIndexOf("."), 4) Dim arrImage() As Byte = ms.GetBuffer ms.Close() Dim strFileName As String = IO.Path.GetFileName(ToolStripStatusLabel1.Text) Dim connectionString As String = "Data Source=MIKEY-HP\jtsql;Initial Catalog=Images;Integrated Security=True" Dim cnn As New SqlConnection(connectionString) Dim DateFiled As Date = FormatDateTime(Now(), DateFormat.ShortDate) Dim strSQL As String = _ "INSERT INTO ImageTab (ImageData,Type,ImgFileName,DateFiled)" & _ "VALUES (@ImageData,@Type,@Filename,'" & DateFiled & "')" Dim cmd As New SqlCommand(strSQL, cnn) With cmd .Parameters.Add(New SqlParameter("@Filename", SqlDbType.VarChar, 50)).Value = strFileName .Parameters.Add(New SqlParameter("@Type", SqlDbType.VarChar, 10)).Value = strType .Parameters.Add(New SqlParameter("@ImageData", SqlDbType.Image)).Value = arrImage End With Try cnn.Open() cmd.ExecuteNonQuery() cnn.Close() Catch ex As Exception MsgBox(ex.ToString) End Try 'Load Try Me.ImageTabTableAdapter.FillBy(Me.ImagesDataSet.ImageTab) Catch ex As System.Exception System.Windows.Forms.MessageBox.Show(ex.Message) End Try

          1 Reply Last reply
          0
          Reply
          • Reply as topic
          Log in to reply
          • Oldest to Newest
          • Newest to Oldest
          • Most Votes


          • Login

          • Don't have an account? Register

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • World
          • Users
          • Groups