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. How to download file from server database

How to download file from server database

Scheduled Pinned Locked Moved ASP.NET
databasesql-serversysadmintutorialquestion
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.
  • F Offline
    F Offline
    FishiFishi
    wrote on last edited by
    #1

    Hi all, In order to download file i have written this code Response.Clear(); Response.AppendHeader("Content-Disposition", "attachment; FileName=" + dt.Tables ["Attachment"].Rows[0]["Attachment_Name"].ToString()); Response.BinaryWrite((Byte[])dt.Tables["Attachment"].Rows[0]["Attachment_File"]); this code works well with SQL server but does nothing with MS Access. is there any alternative of this code is available or how can i make this code usefull for MS Access... Thanx to all

    Regards, Qaiser Nadeem

    S 1 Reply Last reply
    0
    • F FishiFishi

      Hi all, In order to download file i have written this code Response.Clear(); Response.AppendHeader("Content-Disposition", "attachment; FileName=" + dt.Tables ["Attachment"].Rows[0]["Attachment_Name"].ToString()); Response.BinaryWrite((Byte[])dt.Tables["Attachment"].Rows[0]["Attachment_File"]); this code works well with SQL server but does nothing with MS Access. is there any alternative of this code is available or how can i make this code usefull for MS Access... Thanx to all

      Regards, Qaiser Nadeem

      S Offline
      S Offline
      Sathesh Sakthivel
      wrote on last edited by
      #2

      Try with this code Private Sub Page_Load( ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load Response.ContentType = "application\octet-stream" Dim filename as string=new string("c:\\downloads\\hi.doc") Dim downloadFile As System.IO.FileStream = New System.IO.FileStream(filename, IO.FileMode.Open) Response.Write(downloadFile.Length() & "#") downloadFile.Close() Response.WriteFile(filename) Response.Flush() Response.End() End Sub

      Regards, Satips.:rose:

      F 1 Reply Last reply
      0
      • S Sathesh Sakthivel

        Try with this code Private Sub Page_Load( ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load Response.ContentType = "application\octet-stream" Dim filename as string=new string("c:\\downloads\\hi.doc") Dim downloadFile As System.IO.FileStream = New System.IO.FileStream(filename, IO.FileMode.Open) Response.Write(downloadFile.Length() & "#") downloadFile.Close() Response.WriteFile(filename) Response.Flush() Response.End() End Sub

        Regards, Satips.:rose:

        F Offline
        F Offline
        FishiFishi
        wrote on last edited by
        #3

        its VB.NET, do u have c# code???

        Regards, Qaiser Nadeem

        S 1 Reply Last reply
        0
        • F FishiFishi

          its VB.NET, do u have c# code???

          Regards, Qaiser Nadeem

          S Offline
          S Offline
          saravanan05
          wrote on last edited by
          #4

          hi check this http://www.developerfusion.co.uk/Utilities/[^] regards saravanan

          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