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. Web Development
  3. ASP.NET
  4. use db(sql server2000) for storing images

use db(sql server2000) for storing images

Scheduled Pinned Locked Moved ASP.NET
databaseadobehelpquestion
4 Posts 4 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.
  • S Offline
    S Offline
    Subin Alex
    wrote on last edited by
    #1

    i am developing a web app and is it better to use db(sql server2000) for storing images or use a folder for storing the images? I want to know also for flash files. plz help

    C R A 3 Replies Last reply
    0
    • S Subin Alex

      i am developing a web app and is it better to use db(sql server2000) for storing images or use a folder for storing the images? I want to know also for flash files. plz help

      C Offline
      C Offline
      Christian Graus
      wrote on last edited by
      #2

      Storing them on the file system certainly makes for less strain on your site, it depends on what your requirements are.

      Christian Graus Driven to the arms of OSX by Vista.

      1 Reply Last reply
      0
      • S Subin Alex

        i am developing a web app and is it better to use db(sql server2000) for storing images or use a folder for storing the images? I want to know also for flash files. plz help

        R Offline
        R Offline
        rajmca g
        wrote on last edited by
        #3

        if u store those images in a folder it will very easy. but some complexity also there if somebody delete that folder. or else u can store images in database that is difficult but more flexible and relable. so my suggetion is to store in database directly. use below code to store the images in database. If fileImgUpload.PostedFile.ContentLength = 0 Then lblmsg.Visible = True lblmsg.Text = "Please Browse for the New Image/Photo......." lblmsg.ForeColor = Drawing.Color.Red Exit Sub End If openAccessConnection() Dim imageSize As Int64 Dim imageType As String Dim imageStream As Stream ' Gets the Size of the Image imageSize = fileImgUpload.PostedFile.ContentLength ' Gets the Image Type imageType = fileImgUpload.PostedFile.ContentType ' Reads the Image stream imageStream = fileImgUpload.PostedFile.InputStream Dim imageContent(imageSize) As Byte Dim intStatus As Integer intStatus = imageStream.Read(imageContent, 0, imageSize) Dim cmd As New OleDbCommand("insert into tblImg(img_title,img_type,img_stream) values(@img_title,@img_type,@img_stream)", myAccessConnection) cmd.CommandType = CommandType.Text cmd.Parameters.Add("@img_title", OleDbType.VarChar).Value = txt_title.Text.Replace(",", """") cmd.Parameters.Add("@img_type", OleDbType.VarChar).Value = imageType cmd.Parameters.Add("img_stream", OleDbType.LongVarWChar).Value = Convert.ToBase64String(imageContent) cmd.ExecuteNonQuery() closeAccessConnection() txt_title.Text = "" lblmsg.Visible = True lblmsg.ForeColor = Drawing.Color.Green lblmsg.Text = "Photo Uploaded Successfully......" displayImages()

        1 Reply Last reply
        0
        • S Subin Alex

          i am developing a web app and is it better to use db(sql server2000) for storing images or use a folder for storing the images? I want to know also for flash files. plz help

          A Offline
          A Offline
          Abhijit Jana
          wrote on last edited by
          #4

          Subin Alex wrote:

          i am developing a web app and is it better to use db(sql server2000) for storing images or use a folder for storing the images?

          I would suggest you to store images in folder and store the image path in database.

          cheers, Abhijit CodeProject MVP

          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