开发者

How to show video file and word file in gridview from the database? [closed]

开发者 https://www.devze.com 2023-03-12 21:18 出处:网络
It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical andcannot be reasonably answered in its current form. For help clari
It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center. Closed 11 years ago.

im the beginner of .net, im doing the project to save and retrive the files i开发者_JAVA技巧n asp.net with c# , i done saved the files to sql in binary format, and i dont know how to retrive the file in grid view, also i dont know how to play the video file in gridview, can any one help to make that please..


It is not a good practice to save large sized files (like video,documents etc) in database (as binary or varbinary). Instead you upload them to a structured folder outside root and save only the file name(name/path) in the database.

If you really want to do as you asked do the following steps:

  1. Convert the binary file to a byte array as follows,

                byte[] byteArray=GetBinaryFromDB().TOArray();

  2. Then pass the byte array to the following function within System.IO namespace,

                File.WriteAllBytes (strng path, byte[] bytes) //This will save your file in the path you specified as first argument.

In order to play the video file you should design a suitable API (including a flash movie,light box/light window etc)..

0

精彩评论

暂无评论...
验证码 换一张
取 消