473,386 Members | 1,699 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

how to retrive mp3 file from data base

hai all...,
i used to store my mp3 file into database by
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default3.aspx.cs" Inherits="Default3" %>
<%@ import Namespace="System.IO" %>
<%@ import Namespace="System.Data.SqlClient" %>
<%@ import Namespace="System.Drawing.Imaging" %>
<%@ import Namespace="System.Drawing" %>
<%@ import Namespace="System.Data" %>
<%@ import Namespace="System.Web.UI.WebControls" %>
<script runat="server">

void upload(Object s, EventArgs e)
{
// create a byte[] from the input file

int imagelen = songUpload.PostedFile.ContentLength;
byte[] pic = new byte[imagelen];
songUpload.PostedFile.InputStream.Read (pic, 0, imagelen);


//select * from SongDetails

//string connectionString = "connection string";

using (SqlConnection dataConnection = new SqlConnection("Data Source=192.168.0.100;Initial Catalog=master;User ID=sa;Password=;"))
{
using (SqlCommand dataCommand = dataConnection.CreateCommand())

{

dataConnection.Open();

SqlCommand cmd = new SqlCommand ("INSERT INTO SongDetails" + "(SongTitle, SongArtist, Song) VALUES (@SongTitle, @SongArtist, @Song)", dataConnection);

cmd.Parameters.Add("@SongTitle", txtSongTitle.Text);
cmd.Parameters.Add("@SongArtist", txtSongArtist.Text);
cmd.Parameters.Add("@Song",pic);
cmd.ExecuteNonQuery();
Label1.Text =("updated record");
dataConnection.Close();
txtSongTitle.Text = "";
txtSongArtist.Text = "";
}
}
}

</script>
<html>
<head>
<title>HurdLeg.com :: Administrator - Upload</title>
</head>
<body>
<form id="Form1" enctype="multipart/form-data" runat="server">
<p align="Left">
<font size="5"><i>mp3 file into Database</i></font>
</p>
<p><font size="3"></font></p>
<p><font size="3"></font></p>
<p><font size="3"></font></p>
<p>
<font size="3">Title:</font>
<asp:TextBox id="txtSongTitle" runat="server"></asp:TextBox>
</p>
<p>
<font size="3">Artist:</font>
<asp:TextBox id="txtSongArtist" runat="server"></asp:TextBox>
</p>

<p>
<font size="3">File:</font>&nbsp;&nbsp;&nbsp;
<asp:FileUpload id="songUpload" runat="server"></asp:FileUpload>
</p>
<p>
<input id="btnUpload" type="button" value="upload" runat="server" onserverclick="upload" />
<asp:Label ID="Label1" runat="server" Style="z-index: 100; left: 15px; position: absolute;
top: 260px" Width="205px"></asp:Label>
</p>
</form>
</body>
</html>


but iam not able to retrive my mp3 file from database. so please any body can help me
by
varaprasad
Jul 23 '07 #1
0 1521

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: Terry | last post by:
Any .dll or COM+ for .Net can help me retrive data from a Access file? The table contain several columns and the last one is a container which I store Article; because each article is a little bit...
1
by: Santosh | last post by:
Dear All i am writting a code sending mail with attachement. i am writting code for sending mail in one page and code for attaching a file in the next page. aftet attaching a file i am taking...
0
by: avishekb | last post by:
can anyone suggest me how to retrive data from a xml file using c/c++. for example: <schema> <applt to>portno</applyto> <type>int</type> <value>8080</value> </schema> i want to retrive the...
8
by: asenthil | last post by:
Hai, i'm having a string in a specific field of a database... now i want to retrive that string from the database and i have to write that string into a xml file.... retriving is not a...
9
by: asenthil | last post by:
Hai to all,, i had to tried to retrive and write a single row to a file from the database.. But dont know to write all the retrived rows to a file from the database.. how to do that... ...
1
by: srinivasdevakumar | last post by:
MY doubt is how to retrive multiple rows from data base on one condition by using JSP. please tell me
3
by: =?Utf-8?B?UGV0ZXIgSiwgU2Nhbmlh?= | last post by:
Hello I'm looking for an solution about how to retrive data from an client side located Excel document by using an ASP.Net application. I don't want to upload the file to the server. I just want...
1
by: amritranjan | last post by:
How to retrive image file from MS access database and display this in another JSPpage -------------------------------------------------------------------------------- This is my Jsp code for...
1
by: ganesh22 | last post by:
Hi, Here the below code is for dynamically creating textboxs, its creating fine but after user enters some values in textboxs how can i retrive that values? using System; using System.Data;...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.