Click here to Skip to main content
14,421,436 members
Rate this:
Please Sign up or sign in to vote.
See more:
Hi Evry one, I am trying to code a web application for videos and musics, I got stack on trying to upload Video’s path in the database and the system is not giving any error but the browser is just freezing. I can easily upload songs and pictures but the other major problem is with songs paths they’r no playing when I bind them to the repeater. Bellow is my project sample codes:Table, Stored Procedures, NewSoundClass, Main codes and Source code. I am using TableAdapter.
If any one can help please, I'll really appreciate it ..pls,pls
Help also with the codes for downloading music and videos.

Table TBSound

Col_Name		Data_Type		AllowNull
SoundId		int			Unchecked
SoundName		nvarchar(50)	Checked
Soundstream		nvarchar(MAX)	Checked

I have two store procedures:

	@SoundName nvarchar(50),
	@Soundstream nvarchar(MAX)
INSERT INTO [dbo].[TBSound] ([SoundName], [Soundstream]) VALUES (@SoundName, @Soundstream);
-	SELECT SoundId, SoundName, Soundstream FROM TBSound WHERE (SoundId = SCOPE_IDENTITY())
2.	ALTER PROCEDURE dbo.SelectQuerySound
	@SoundId int
SELECT        Soundstream
FROM            TBSound
1.	WHERE        (SoundId = @SoundId)

Here bellow is my class where I call my stored procedures using TableAdapter

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;

/// <summary>
/// Summary description for NewSound
/// </summary>
public class NewSound
    SoundDataSet1TableAdapters.TBSoundTableAdapter MyVid = new SoundDataSet1TableAdapters.TBSoundTableAdapter();  
	public NewSound()
		// TODO: Add constructor logic here
    public bool SaveMed(string SoundName, string SoundStream)
        int MySound = MyVid.SaveM(SoundName, SoundStream);
        return MySound == 1;
    public SoundDataSet1.TBSoundDataTable SearchM(int SoundId)
        return MyVid.GetDataBySound(SoundId); 

My Main Codes
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.IO;  

public partial class _Default : System.Web.UI.Page 
    NewSound VidSound = new NewSound();
    protected void Page_Load(object sender, EventArgs e)

    protected void btnSaveUpload_Click(object sender, EventArgs e)
       //string stream = File.ReadAllBytes(FileUpload1.PostedFile.FileName);

       string FileName = Path.GetFileName(FileUpload1.FileName);

       //Save files to disk
       FileUpload1.SaveAs(Server.MapPath("Videos/" + FileName));

        //com.Parameters.AddWithValue("@voice", stream);

    protected void btnRepeater_Click(object sender, EventArgs e)
        RepeatData.DataSource = VidSound.SearchM(Convert.ToInt32(TextBox1.Text));

Source Codes
<%@ Page Language="C#" AutoEventWireup="true"  CodeFile="Default.aspx.cs" Inherits="_Default" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "">

<html xmlns="">
<head  runat="server">
    <form id="form1"  runat="server">
        <table class="style1">
                <td class="style2" colspan="3">
                    Inserting Sound And Video in the Database</td>
                <<br mode="hold" />                <td class="style3">
                    <asp:TextBox ID="TextBox1" runat="server">
                <td colspan="2">
                    <asp:FileUpload ID="FileUpload1" runat="server" />
                <td class="style3">
                    <asp:Label ID="Label1" runat="server" Text="Label">
                    <asp:Button ID="Button1" runat="server" onclick="Button1_Click" Text="Button" />
                    <asp:Button ID="Button2" runat="server" onclick="Button2_Click" 

                        Text="Repeater" />
                    <asp:Repeater ID="RepeatData" runat="server">
            <object id="player" 


                       height="170" width="300">
                <param name="url">
                  value='<%# "VideoHandler.ashx?id=" + Eval("SoundId") %>'/>
                <param name="showcontrols" value="true" />
                <param name="autostart" value="true" />

the idea is to have by the end a gridview that look like this:

Sound Id	Sound Name	View/Listen	Get it
01	        Single Lady	Play	        Download
Updated 31-Dec-13 4:07am
ZurdoDev 31-Dec-13 8:53am
What's your question exactly?
Nelek 31-Dec-13 9:36am
See the title of the message. ;P
ZurdoDev 31-Dec-13 9:45am
Ah yes, so clear. :)
What is exactly happening when the code executes? When you click on Play button what happens?
Member 10490380 2-Jan-14 9:38am
When I click on play button the repeater is not palying the son or the video, so pls i need a help

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