i'm having a problem in retrieving .wav file in ms access in my code in c# it says that the wave header is corrupt! can someone help me with this? thanks :)

cmd = new OleDbCommand("Select SOUND from SOUND where TITLE like" + "'" + textBox1.Text + "'", conn);
                dr = cmd.ExecuteReader();
                if (dr.Read() == true)
                {
                    byte[] result = (byte[])dr["SOUND"];


                    MemoryStream ms = new MemoryStream(result, true);
                    SoundPlayer sp = new SoundPlayer(ms); 
                    ms.Position = 0; 
                    sp.Stream = null;
                    sp.Stream = ms; 
                    sp.Play(); // error here!! :(

                }
                else
                    MessageBox.Show("error");

The method you are using to play the sound is OK.
The following code works fine for me.

byte[] result = System.IO.File.ReadAllBytes(@"C:\WINDOWS\Media\ding.wav");
            System.IO.MemoryStream ms = new System.IO.MemoryStream(result);
            SoundPlayer sp = new SoundPlayer(ms);
            sp.Play();

Have you checked that there is data in result?
How are you putting the data in to your DB?

The method you are using to play the sound is OK.
The following code works fine for me.

byte[] result = System.IO.File.ReadAllBytes(@"C:\WINDOWS\Media\ding.wav");
            System.IO.MemoryStream ms = new System.IO.MemoryStream(result);
            SoundPlayer sp = new SoundPlayer(ms);
            sp.Play();

Have you checked that there is data in result?
How are you putting the data in to your DB?

i insert object in the datasheet view database ms access..ole object..

thanks for replying on my post :)

Hi ishtine18,
did u solved this issue?

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.