Click here to Skip to main content
15,747,059 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi,
i have a field in my sql database that is saved a binary data,
this binary data is a zipped file.
how to read this data and convert it to zip file?
Posted

Just retrieve the data as binary and then save it (with zip extension) using a BinaryWriter[^].
 
Share this answer
 
Hope u r using ADO.net

C#
 // Initalize connection before this
SqlCommand cmd=new SqlCommand("select zipdat from table",con); //con for sqlconnection

//zipdat is column where you stored bytes of zip file

con.Open();



byte [] zipbts=(byte[])cmd.ExecuteScalar();


File.WriteAllBytes("C\\myfile.zip",zipbts);



Hope this helps

best of luck..........
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900