当前注册人数423093人 邮箱: 密码: 注册新用户 忘记密码
首页 C/C++/MFC C# ASP.NET VB.NET MATLAB Android   站内搜索 下载代码说明/积分规则
为什么要注册?

1. 可以直接免费从本站下载代码,防止邮件发送不到您的邮箱,或登录不了国外网站

2. 可以设定关键字,当有您关心的代码收录时,邮件通知您

3. 对这里的代码进行评分和评论

4. 可以和大家一起分享你的源代码,得到更多的建议

Video Uploader to SQL Server Control

ASP.NET中SQL Server视频存储及播放控件源代码

2007年12月11日
C# 3.0, Windows, .NET 2.0, ASP.NET, WebForms, VS2005, VS2008, Dev
本程序是一个用户控件,它的功能是向SQL Server数据库中写入视频、声音、图像等数据,并且,在asp.net页面中,使用一个播放控件播放数据库中的视频。使用的技术有ADO.NET,C#。
相关知识

主要思想,读取文件byte流,写入数据库,读取的关键代码如下:

<asp:Button ID="ButtonShowVideo" runat="server" onclick="ButtonShowVideo_Click" 
        Text="Show Video" />
    <asp:Repeater ID="Repeater1" runat="server">
        
            <object id="player" classid="clsid:6BF52A52-394A-11D3-B153-00C04F79FAA6" 
                        height="170" width="300">

 

public class VideoHandler : IHttpHandler 
{
    
    public void ProcessRequest (HttpContext context) 
    {
        string connectionString = ConfigurationManager.ConnectionStrings["uploadConnectionString"].ConnectionString;

        SqlConnection connection = new SqlConnection(connectionString);
        SqlCommand cmd = new SqlCommand("SELECT Video, Video_Name FROM Videos WHERE ID = @id", connection);
        cmd.Parameters.Add("@id", SqlDbType.Int).Value = context.Request.QueryString["id"];
        try
        {
            connection.Open();
            SqlDataReader reader = cmd.ExecuteReader(CommandBehavior.Default);
            if (reader.HasRows)
            {
                while (reader.Read())
                {
                    context.Response.ContentType = reader["Video_Name"].ToString();
                    context.Response.BinaryWrite((byte[])reader["Video"]);
                }
            }
        }
        finally
        {
            connection.Close();
        }
    }
 
    public bool IsReusable 
    {
        get {
            return false;
        }
    }

}
源代码原文下载:
Video Uploader to SQL Server Control Upload and Insert video, audio, or image to SQL Server and how to show it in aspx page. This article will explain how to upload and insert files into sql server (specially audio, video, images files) using C# and ADO.NET, and then how to show the video file in asp.net page with a player control

源码图片

从本站下载附件及源代码(1个附件,已经成功下载687次)

最值得关注的外文源代码

Event Calendar [ ASP.NET 2.0 / C# ]
GPS Tracer Extension: Storing the Path on SQL2005 via Web Services
A Collection of CodeSmith templates to Replace and Extend the LINQ to SQL Designers
php4dvd - movie database
评论(评论是增加积分的一个有效途径)
字数在300字内
请如实评论
本源代码共评论72次,此处显示最近20次评论! 查看所有评论

老顽童  2014年10月12日
正是学习所需资料
hefeng_aspnet  2013年09月12日
感谢分享
sus304  2013年08月12日
感谢分享
e  2013年02月19日
ASP.NET中SQL Server视频存储及播放控件源代码
cx4359481  2012年01月04日
谢谢分享
jennie.tlj  2012年01月04日
thanks
fax518  2011年04月03日
非常~~谢谢~~
bellwang  2010年12月22日
正需要的
hello  2010年03月05日
可以
lhjlhjjhl  2009年12月29日
xiexie
funszy  2009年12月23日
学习下啊
dies53  2009年08月14日
学习下啊
ylgshuai  2009年06月13日
认真学习
杨平  2009年06月02日
学习下
shisanjun  2009年05月10日
学习了
shenyu35  2009年05月01日
我也需要ing....
haitangwei  2009年04月21日
学习一下啊
gaogao  2009年03月29日
明明登陆了,怎么显示的是没有登陆,下载的是RESOURCE.ASHX
gaogao  2009年03月29日
不论是否对我的设计有帮助,都谢谢楼主。
liwenbing0104  2009年03月16日
不错
字数在300字内
请如实评论
200万国内源码搜索
CopyRight (C) codesoso.com 2007-2009 All Rights Reserved zhihuishi   免责声明