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. Storing & retrieving swf file from sql server

Storing & retrieving swf file from sql server

Scheduled Pinned Locked Moved ASP.NET
databasesql-serveradobesysadminhelp
7 Posts 2 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.
  • T Offline
    T Offline
    Tarun Dudhatra
    wrote on last edited by
    #1

    Hi friends, I am developing one application. In our application there are two types of multimedia object like Image and flash object. And I want to save it into sql server 2005 I can save image into database and also retrieve it successfully. But I cannot save and retrive swf object to and from database can anybody help me. Thanks

    N 1 Reply Last reply
    0
    • T Tarun Dudhatra

      Hi friends, I am developing one application. In our application there are two types of multimedia object like Image and flash object. And I want to save it into sql server 2005 I can save image into database and also retrieve it successfully. But I cannot save and retrive swf object to and from database can anybody help me. Thanks

      N Offline
      N Offline
      N a v a n e e t h
      wrote on last edited by
      #2

      Swf files are similar like any other files. What is the content type you given when sending this to page, what problem you are facing when fetching the data ?

      All C# applications should call Application.Quit(); in the beginning to avoid any .NET problems.- Unclyclopedia My Website | Ask smart questions

      T 1 Reply Last reply
      0
      • N N a v a n e e t h

        Swf files are similar like any other files. What is the content type you given when sending this to page, what problem you are facing when fetching the data ?

        All C# applications should call Application.Quit(); in the beginning to avoid any .NET problems.- Unclyclopedia My Website | Ask smart questions

        T Offline
        T Offline
        Tarun Dudhatra
        wrote on last edited by
        #3

        Ya that I know when we store image it will store as a binary and when we store swf file it will store like binary only. But the mail problem is that how can we retrieve it I want to convert this 3 line only. Response.ContentType = "image/jpeg"; // 1 Response.ContentType = "application/x-shockwave-flash"; // Done System.Drawing.Image image = RetrieveImage(id, tname); image.Save(Response.OutputStream, System.Drawing.Imaging.ImageFormat.Jpeg); How can we change this two line for shockwavw object

        N 1 Reply Last reply
        0
        • T Tarun Dudhatra

          Ya that I know when we store image it will store as a binary and when we store swf file it will store like binary only. But the mail problem is that how can we retrieve it I want to convert this 3 line only. Response.ContentType = "image/jpeg"; // 1 Response.ContentType = "application/x-shockwave-flash"; // Done System.Drawing.Image image = RetrieveImage(id, tname); image.Save(Response.OutputStream, System.Drawing.Imaging.ImageFormat.Jpeg); How can we change this two line for shockwavw object

          N Offline
          N Offline
          N a v a n e e t h
          wrote on last edited by
          #4

          TarDuk wrote:

          System.Drawing.Image image = RetrieveImage(id, tname); image.Save(Response.OutputStream, System.Drawing.Imaging.ImageFormat.Jpeg);

          Assume you have the byte array in b[]. Response.BinaryWrite(b); ?

          All C# applications should call Application.Quit(); in the beginning to avoid any .NET problems.- Unclyclopedia My Website | Ask smart questions

          T 1 Reply Last reply
          0
          • N N a v a n e e t h

            TarDuk wrote:

            System.Drawing.Image image = RetrieveImage(id, tname); image.Save(Response.OutputStream, System.Drawing.Imaging.ImageFormat.Jpeg);

            Assume you have the byte array in b[]. Response.BinaryWrite(b); ?

            All C# applications should call Application.Quit(); in the beginning to avoid any .NET problems.- Unclyclopedia My Website | Ask smart questions

            T Offline
            T Offline
            Tarun Dudhatra
            wrote on last edited by
            #5

            private System.Drawing.Image RetrieveImage(string id,string tname) { System.Drawing.Image image = null; strcon = System.Configuration.ConfigurationManager.AppSettings["ConnectionString"]; Con = new SqlConnection(strcon); Con.Open(); Cmd = new SqlCommand("SELECT imgimage FROM latework where imgid='" + id + "'", Con); Cmd.CommandType = CommandType.Text; SqlDataReader Dr = Cmd.ExecuteReader(); if (Dr.Read()) { byte[] imageData = (byte[])Dr[0]; MemoryStream memStream = new MemoryStream(imageData); image = System.Drawing.Image.FromStream(memStream); } return image; } This is my code to retrive an Image ok now can u do something? Thanks

            N 1 Reply Last reply
            0
            • T Tarun Dudhatra

              private System.Drawing.Image RetrieveImage(string id,string tname) { System.Drawing.Image image = null; strcon = System.Configuration.ConfigurationManager.AppSettings["ConnectionString"]; Con = new SqlConnection(strcon); Con.Open(); Cmd = new SqlCommand("SELECT imgimage FROM latework where imgid='" + id + "'", Con); Cmd.CommandType = CommandType.Text; SqlDataReader Dr = Cmd.ExecuteReader(); if (Dr.Read()) { byte[] imageData = (byte[])Dr[0]; MemoryStream memStream = new MemoryStream(imageData); image = System.Drawing.Image.FromStream(memStream); } return image; } This is my code to retrive an Image ok now can u do something? Thanks

              N Offline
              N Offline
              N a v a n e e t h
              wrote on last edited by
              #6

              TarDuk wrote:

              if (Dr.Read()) { byte[] imageData = (byte[])Dr[0]; MemoryStream memStream = new MemoryStream(imageData); image = System.Drawing.Image.FromStream(memStream); } return image; }

              Replace this with

              byte[] imageData = (byte[])Dr[0];
              Response.ContentType = //as you set
              Response.BinaryWrite(imageData)

              TarDuk wrote:

              private System.Drawing.Image RetrieveImage(string id,string tname)

              If this function is in your page, make it as void. If it is in a class, you won't get access to Response object until you pass it to the class

              All C# applications should call Application.Quit(); in the beginning to avoid any .NET problems.- Unclyclopedia My Website | Ask smart questions

              T 1 Reply Last reply
              0
              • N N a v a n e e t h

                TarDuk wrote:

                if (Dr.Read()) { byte[] imageData = (byte[])Dr[0]; MemoryStream memStream = new MemoryStream(imageData); image = System.Drawing.Image.FromStream(memStream); } return image; }

                Replace this with

                byte[] imageData = (byte[])Dr[0];
                Response.ContentType = //as you set
                Response.BinaryWrite(imageData)

                TarDuk wrote:

                private System.Drawing.Image RetrieveImage(string id,string tname)

                If this function is in your page, make it as void. If it is in a class, you won't get access to Response object until you pass it to the class

                All C# applications should call Application.Quit(); in the beginning to avoid any .NET problems.- Unclyclopedia My Website | Ask smart questions

                T Offline
                T Offline
                Tarun Dudhatra
                wrote on last edited by
                #7

                Thanks a lot N a v a n e e t h I will try with that code and tell u later ok thanks again.

                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