Пример #1
0
        public override async Task RollbackAsync(string savePointName, CancellationToken cancellationToken = default)
#endif
        {
            EnsureSavePointName(savePointName);
            EnsureCompleted();
            try
            {
                var command = new FbCommand($"ROLLBACK WORK TO SAVEPOINT {savePointName}", _connection, this);
#if NET48 || NETSTANDARD2_0
                using (command)
#else
                await using (command.ConfigureAwait(false))
#endif
                {
                    await command.ExecuteNonQueryAsync(cancellationToken).ConfigureAwait(false);
                }
            }
            catch (IscException ex)
            {
                throw FbException.Create(ex);
            }
        }
Пример #2
0
 private void DataBaseSendData(long IMEI, DateTime dt, int latitude, int longitude, int speed, FbConnection fb)
 {
     if ((latitude != 0) && (longitude != 0))
     {
         fbt = fb.BeginTransaction();
         using (
             var insertSQL = new FbCommand("insert into sms" +"(sms.IMEI, sms.DATE_, sms.TIME_, sms.LATITUDE, sms.LONGITUDE, sms.SPEED) values('"+ IMEI 
             + "','" + dt.ToShortDateString() 
             + "','" + dt.ToLongTimeString() 
             + "','" + latitude 
             + "','" + longitude 
             + "','" + speed 
             + "');", fb)) // using Firebird DB, FBCommand haven't method "AddWithValue".
         {
             if (fb.State == ConnectionState.Closed)
             {
                 fb.Open();
             }
             insertSQL.Transaction = fbt;
             try
             {
                 insertSQL.ExecuteNonQueryAsync();
                 fbt.Commit();
             }
             catch (Exception ex)
             {
                 fbt.Rollback();
                 Log.Add(ex.Message + "\r\n" + ex.Source + "\r\n" + ex.TargetSite);
             }
         }
     }
 }