public void ProcessETLMode(IRecordProcessor rp)
        {
            inputDatabase.Connect();
            MapFields(rp);

            rp.setDatasetName(inputDatabase.NormTableName(tableName));


            string[] sqls = rp.GetSelectStatements();

            if (Progress != null)
            {
                Progress.ReportProgress(0);
            }
            foreach (string sql in sqls)
            {
                try
                {
                    DbDataReader reader = inputDatabase.Execute(sql);
                    int          count  = 1;
                    rp.Reset();
                    //Extract
                    while (reader.Read())
                    {
                        //Transform
                        rp.ProcessRecord(reader);
                        if (Progress != null)
                        {
                            Progress.ReportProgress(0, "Read records: " + count.ToString());
                        }
                        count++;
                    }
                    reader.Close();
                    reader = null;

                    //Load
                    if (outputDatabase.FileName != null)
                    {
                        //if output is file - Write one
                        WriteData();
                    }
                }
                catch (Exception ex)
                {
                    throw ex;
                }
                // Call Close when done reading.
            }
            inputDatabase.Close();
        }
        public void ProcessEditMode(IRecordProcessor rp)
        {
            inputDatabase.Connect();
            outputDatabase.Connect();
            MapFields(rp);
            rp.setDatasetName(inputDatabase.NormTableName(tableName));

            if (Progress != null)
            {
                Progress.ReportProgress(0);
            }
            try
            {
                int count          = ProcessOffset;
                int processedCount = 0;
                int totalCount;

                rp.Reset();

                //Extract
                inputDatabase.SetTable(tableName);
                outputDatabase.SetTable(tableName);

                totalCount = inputDatabase.GetRowsCount();

                if (ProcessOffset > 0)
                {
                    inputDatabase.SeekRecord(ProcessOffset);
                }
                else
                {
                    inputDatabase.FirstRecord();
                }

                //!! Skip first line as it Header
                while (inputDatabase.NextRecord())
                {
                    DataRow row = inputDatabase.CurrentRow();

                    //Transform
                    if (rp.ProcessRow(row))
                    {
                        //Load if row changed
                        outputDatabase.UpdateRow(count + 1, row);

                        if (Progress != null)
                        {
                            Progress.ReportProgress((processedCount * 100) / (totalCount - ProcessOffset), string.Format("Records: Read {0} (Processed {1}) of {2}", count, processedCount, totalCount));
                        }

                        processedCount++;
                    }
                    count++;
                }

                //Load
                if (outputDatabase.FileName != null)
                {
                    outputDatabase.Write(outputDatabase.FileName);
                }
                //Set complete
                Progress.ReportProgress(100, string.Format("Read records: {0}, Processed {1}", count, processedCount));
            }
            catch (Exception ex)
            {
                throw ex;
            }
            // Call Close when done reading.

            inputDatabase.Close();
            outputDatabase.Close();
        }