0
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 .

2
Contributors
1
Reply
2
Views
8 Years
Discussion Span
Last Post by sknake
0

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.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.