Storing & retrieving swf file from sql server
-
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
-
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
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
-
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
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
-
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
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
-
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
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
-
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
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 classAll C# applications should call Application.Quit(); in the beginning to avoid any .NET problems.- Unclyclopedia My Website | Ask smart questions
-
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 classAll C# applications should call Application.Quit(); in the beginning to avoid any .NET problems.- Unclyclopedia My Website | Ask smart questions
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.