ATTENTION: You are viewing a page formatted for mobile devices; to view the full web page, click HERE.

Other Software > Developer's Corner

Visual Web Developer 2008 - newbie questions and help requests

<< < (2/2)

cai:
hi, im trying to insert flash into my database in visual web but it seem that it cannot be done.. is there any way that i can do it? or it is not possible to insert flash into the database and only on the aspx page.

CWuestefeld:
You can put anything you want into a DB (depending on the DB engine you're using). If you're using SQL Server, for example, you'd want to declare the column as type VARBINARY(MAX). The way to insert the flash into the DB is just like you'd insert anything else: get the data (probably by writing a program that reads the bits from the .swf file) and then insert it into the DB. I understand that SQL Server 2008 has a way to pass through stuff like this so it actually gets stored in the filesystem, but I haven't tried it.

The challenging part here is getting the flash back out in a usable fashion. You'd normally just EMBED an object into the HTML that refers to the .swf file. When the browser want the flash, it sends a request to your server that downloads that file. The thing is, you've no longer got a file -- you stuffed it into the database! So you've got to make a page that reads the database and streams it back to the user (rather than returning HTML as you normally would), and use that as the URL of the object in the EMBED.

I've done this all before, but in my experience it's rarely worth the trouble. Generally you can get what you need just by storing the path/filename of the SWF and serving that out when page is constructed.

Navigation

[0] Message Index

[*] Previous page

Go to full version