public static void SetBytes(string resName, int recordId, byte[] data) { RecordStore rs = null; try { rs = RecordStore.OpenRecordStore(resName, true); if (rs.GetNumRecords() == 0) { rs.AddRecord(data, 0, data.Length); } else { rs.SetRecord(recordId, data, 0, data.Length); } } catch (RecordStoreException ex) { Log.Exception(ex); } finally { CloseRecordStore(rs); } }