Beispiel #1
0
        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);
            }
        }
Beispiel #2
0
        public static int AddBytes(string resName, byte[] data)
        {
            RecordStore rs     = null;
            bool        opened = false;

            try
            {
                rs     = RecordStore.OpenRecordStore(resName, true);
                opened = true;
                return(rs.AddRecord(data, 0, data.Length));
            }
            catch (RecordStoreException ex)
            {
                Log.Exception(ex);
            }
            finally
            {
                CloseRecordStore(rs);
            }
            return(opened ? COULD_NOT_SAVE : COULD_NOT_OPEN);
        }