Click here to Skip to main content
11,708,721 members (70,951 online)
Click here to Skip to main content
Articles » Web Development » ASP.NET » Data » Downloads
Add your own
alternative version

Video Uploader Control for SQL Server

, 28 Nov 2007 CPOL 171K 8.5K 119
Upload and insert video, audio, or image to SQL Server, and show it in an ASPX page.
VideoUploaderControl.zip
UploadGallery
App_Code
App_Data
using System;
using System.Data;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Data.SqlClient;

public partial class _Default : System.Web.UI.Page 
{
    protected void Page_Load(object sender, EventArgs e)
    {

    }
    protected void ButtonBind_Click(object sender, EventArgs e)
    {
        GridView1.DataSource = GetVideoInfo();
        GridView1.DataBind();
    }

    private DataTable GetVideoInfo()
    {
        string connectionString = ConfigurationManager.ConnectionStrings["uploadConnectionString"].ConnectionString;
        SqlDataAdapter adapter = new SqlDataAdapter("SELECT * FROM Videos", connectionString);
        DataTable table = new DataTable();
        adapter.Fill(table);
        return table;
    }

    private DataTable GetSpecificVideo(object i)
    {
        string connectionString = ConfigurationManager.ConnectionStrings["uploadConnectionString"].ConnectionString;
        SqlDataAdapter adapter = new SqlDataAdapter("SELECT Video, ID FROM Videos WHERE ID = @id", connectionString);
        adapter.SelectCommand.Parameters.Add("@id", SqlDbType.Int).Value = (int)i;
        DataTable table = new DataTable();
        adapter.Fill(table);
        return table;
    }
    protected void ButtonShowVideo_Click(object sender, EventArgs e)
    {
        Repeater1.DataSource = GetSpecificVideo(2);
        Repeater1.DataBind();
    }
}

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

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

Share

About the Author

Islam ElDemery
Web Developer Business Development Gate
Egypt Egypt

You may also be interested in...

| Advertise | Privacy | Terms of Use | Mobile
Web02 | 2.8.150819.1 | Last Updated 28 Nov 2007
Article Copyright 2007 by Islam ElDemery
Everything else Copyright © CodeProject, 1999-2015
Layout: fixed | fluid