String SQL="select * from table where xx='XXX'";
The DataTable ta=new DataTable ();
Ta=DBHelper. GetDataTable (SQL);
Byte [] bytes=(byte []) ta.621 Rows [0] (" column ");//the query base64 files array
/method is called
Bytes2File (bytes, "where to download a path"); Such as E: \ \ test \ \ XXXX PDF/suffix to add
Public static void Bytes2File (byte [] buff, string savepath)
{
If (System. IO. File. The Exists (savepath))
{
System. IO. File. Delete (savepath);
}
FileStream fs=new FileStream (savepath, FileMode CreateNew);
BinaryWriter bw=new BinaryWriter (fs);
Bw. Write (buff, 0, buff. Length);
Bw. The Close ();
Fs. The Close ();
}
CodePudding user response:
System. IO. File. WriteAllBytes ()
Can get this done in a sentence.
CodePudding user response:
With the error, behind WriteAllBytes error