473,395 Members | 1,689 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,395 software developers and data experts.

Need reference for storing/retrieving .wav files in Sql2000

I can successfully write the binary data to an image data type, and
successfully retrieve it, but when I attempt to play the file in media player
after retrieving it, I get the file type isn't supported.

I must be losing something somewhere, but the byte lengths match up. Is
there some encoding I need to do.

Please take a look, and suggestions would be appreciated.
//Writing to sql from file

FileStream fs = new FileStream("xxx.wav", FileMode.Open, FileAccess.Read);

BinaryReader br = new BinaryReader(fs);
long size = fs.Length;

byte[] data = new byte[size];

br.Read(data,0,data.Length);

Database db = DatabaseFactory.CreateDatabase("IvrRecordingDB");

DBCommandWrapper cmd = db.GetStoredProcCommandWrapper("uspInsertRecording ");

cmd.AddInParameter("@recording", DbType.Binary, data);

db.ExecuteNonQuery(cmd);

//Retrieving data and writing to file
byte[] data = new byte[0];

Database db = DatabaseFactory.CreateDatabase("IvrRecordingDB");
DBCommandWrapper cmd = db.GetStoredProcCommandWrapper("uspGetRecording");

object audioBinary = db.ExecuteScalar(cmd);
data = (byte[])(audioBinary);

FileStream fs = new FileStream("new.wav",FileMode.CreateNew);
BinaryWriter bw = new BinaryWriter(fs);

bw.Write(data,0,data.Length);
bw.Close();
fs.Close();

Jan 13 '06 #1
0 1218

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: LizP | last post by:
Hi, guys - looking for a bit of help/advice on moving a database from SQL 7 to SQL 2000. We've a third party application which currently uses a SQL7 database. This database has a number of views...
2
by: Tan Tze Yong | last post by:
Dear all, I am tasked to write a program in C++ recently. However my knowledge in C++ is very limited. What happened is I am storing serveral vectors in a map. I need to retrieve the vector from...
5
by: Don Vaillancourt | last post by:
I'm building a system when one can upload a document to the website. I will be storing the document on the hard-drive for quick/easy access, but I was also thinking of storing it in an existing...
4
by: Lucas Tam | last post by:
Hi all, I'm currently storing a reference to the entire thread object in my application. However, I'm wondering if there is a smaller object I can point to such as an Integer ThreadID? If...
1
by: Byron | last post by:
Hi, I have(had) an old Win2k Server server with about 30 web site databases (SQL 2000) that just went under due to hardware problems. Thankfully, I have backups of all the databases plus the MDF...
2
by: Chris Thunell | last post by:
I have a sql database that stores documents (word and excel files) inside a field. These documents can be 10mb or larger in size. When running on my local network the files load very quickly, but...
2
by: Alejandro Kwiatkowski | last post by:
How I can do to store and retrieve files to/from a fields in a SQL Server table using .NET 2.0 Thanks you in advance Alejandro
2
by: Gitesh | last post by:
Hi All, Could anyone help me out with storing PDFs into Oracle DB and then retrieving and displaying it back in the browser. Thanks in Advance, Gitesh
2
by: WT | last post by:
Hello, Could we use 'Embedded resources' with resx files that contain text resources used in aspx pages with the syntaxe: Text="<%$ Resources:ResourcesMy,KEY1 %>" I tryed removing the...
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: 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: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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?
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

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.