private void btnplay_Click(object sender, EventArgs e)
        {
            objConn.Open();

            string str1 = "select s from Table1";
            OleDbCommand objComm = new OleDbCommand(str1, objConn);

            OleDbDataReader dr = objComm.ExecuteReader();
            dr.Read();
            Byte[] bindata = (byte[])dr.GetValue(0);

            FileStream fs1 = new FileStream("C:\\dummy\\Buffer.mp3", FileMode.Create, FileAccess.ReadWrite);
            BinaryWriter bw = new BinaryWriter(fs1);

            int filelength = bindata.Length;
            bw.Write(bindata);
            fs1.Write(bindata, 0,filelength);

            string bufferfielname = "C:\\dummy\\Buffer.mp3";
            axWindowsMediaPlayer1.URL = bufferfielname;
        }

The buffer.mp3 file is getting created , but the problem is
its size is 0 which means byte contents is not written into it .

Please tell me whether there is something wrong in fs1.write function or is there anyother function .

Why don't you call File.WriteAllBytes(@"C:\test.mp3", bindata); ? Also use your debugger and see if you actually have data inside of the byte array.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.