Click here to Skip to main content
14,486,715 members
Rate this:
Please Sign up or sign in to vote.
See more:
I want to insert, extract, and view a video file in a C#sql database. how do I do this? does anyone have any ideas ?
I haven't tried anything yet.


What I have tried:

I haven't tried anything yet.
Posted
Updated 11-Mar-20 9:48am
Rate this:
Please Sign up or sign in to vote.

Solution 1

Basically, don't.
Video files get big, and very, very quickly. So retrieving them from the DB and displaying them does two things:
1) It makes your DB harder and a lot slower to backup (video files are already compressed, so the data doesn't "squash" hardly at all when the backup system tries to compress the DB - and a DB failure means a much, much larger restore operation!
2) Uses bandwidth like crazy: first to fetch the data from the DB - which takes considerable time - and then again to stream it.

So instead, store the videos in the file system, and store the path to that file in the DB. That way, the DB storage is trivial, and no extra bandwidth is used to fetch it from teh DB when the user needs it.

And streaming a file is pretty simple!
   
Comments
Member 14625523 11-Mar-20 15:16pm
   
how do I do this?
phil.o 11-Mar-20 16:51pm
   
Begin by trying; everything had to be tried at some point to come up.
OriginalGriff 12-Mar-20 3:13am
   
Are you saying that you don't know how to insert a string into a DB?
Because if you are, you are way out of your depth with the rest of this whole project...
Rate this:
Please Sign up or sign in to vote.

Solution 2

Quote:
I want to insert, extract, and view a video file in a C#sql database. how do I do this? does anyone have any ideas ?

Basically, it is a bad idea, because it will abuse the SQL server.
The idea is to store the video file in server file system, possibly renamed.
Then use 2 fields in database, 1 field is file name in server file system, 1 field is original/public file name.
   
Comments
Member 14625523 12-Mar-20 8:29am
   
How do I do this?

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)




CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100