'display a PDF file stored on BLOB Without Saving- SQLite ( SQL )

I save PDF files as Blob objects on a SQLite database. I will use a datagridview to navigate on records and i need when selection changed to display the pdf file on Adobe reader module (axAcroPDF). I dont know if it can displayed without the need of saving the file first (would be better). One approach is the

  sqlite.Open();
        bool em = false;
        using (SQLiteCommand cmd = new SQLiteCommand("select PDFile from tbl_PatHistory where ID=23", sqlite)) 
        {
            using ( reader = cmd.ExecuteReader(CommandBehavior.Default))
            {
                if (reader.Read())
                {
                    em = true;
                    byte[] fileData = (byte[])reader.GetValue(0);
                    using (FileStream fs = new FileStream(File, FileMode.Create, FileAccess.ReadWrite))
                    {
                        using (BinaryWriter bw = new BinaryWriter(fs))
                        {
                            bw.Write(fileData);
                            bw.Close(); // Need to be continued


                        }
                    }
                }

and a second approach that i get an error on "LocalEncoding"

 string sql = "select PDFile from tbl_PatHistory where ID=23";
        SQLiteCommand cmd = new SQLiteCommand(sql, conn);
        SQLiteDataAdapter adapter = new SQLiteDataAdapter(cmd);
        DataTable table = new DataTable();
        adapter.Fill(table);
        if (table.Rows.Count > 0)
        {
            byte[] ap = (byte[])table.Rows[0]["Content"];
           
            axAcroPDF1.src =  LocalEncoding.GetString(ap.ToArray());
        }


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source