Ejemplo n.º 1
0
        private static bool fcnGetWebCustomFieldDefs(clsCustomFieldIRDef[] _cstWebFlags, clsCustomFieldIRDef[] _cstWebFields)
        {
            string strSQL = "";

            bool blnRes = false;

            //init
            for (int intI = 0; intI < _cstWebFlags.Length; intI++)
            {
                _cstWebFlags[intI] = new clsCustomFieldIRDef();
                _cstWebFields[intI] = new clsCustomFieldIRDef();
            }

            try
            {
                using (wsXferEventInfo.XferEventInfo wsDLFlags = new global::CTWebMgmt.wsXferEventInfo.XferEventInfo())
                {
                    strSQL = "SELECT strFieldName, strValue " +
                            "FROM tblCustomVals " +
                        "WHERE lngProgramID = 0 AND " +
                            "lngCTUserID = " + clsAppSettings.GetAppSettings().lngCTUserID.ToString() + " AND " +
                            "(strFieldName LIKE 'blnUse%Field%' OR " +
                                "strFieldName LIKE 'blnUse%Flag%' OR " +
                                "strFieldName LIKE 'strFlag%' OR " +
                                "strFieldName LIKE 'strField%') " +
                            "ORDER BY strFieldName";

                    string strWebXML = "";

                    try { strWebXML = wsDLFlags.fcnGetRecords(strSQL, "tblCustomVals", clsWebTalk.strWebConn); }
                    catch (Exception ex) { MessageBox.Show("There was an error retrieving custom field definitions from the web: " + ex.Message); }

                    DataSet dsXML = new DataSet("tblCustomVals");

                    dsXML.ReadXml(new System.IO.StringReader(strWebXML), XmlReadMode.ReadSchema);

                    foreach (DataTable tbl in dsXML.Tables)
                    {
                        foreach (DataRow row in tbl.Rows)
                        {
                            string strFieldName = "";
                            string strFieldVal = "";

                            foreach (DataColumn col in tbl.Columns)
                            {
                                string strColName = col.ColumnName;
                                string strColVal = Convert.ToString(row[col]);

                                if (strColName == "strFieldName") strFieldName = strColVal;
                                else if (strColName == "strValue") strFieldVal = strColVal;
                            }

                            //evaluate field, val, set control value
                            if (strFieldName.IndexOf("blnUseCamperField") >= 0)
                                _cstWebFields[Convert.ToInt32(strFieldName.Substring(17, strFieldName.Length - 17)) - 1].blnUseCamper = Convert.ToBoolean(strFieldVal);
                            else if (strFieldName.IndexOf("blnUseCamperFlag") >= 0)
                                _cstWebFlags[Convert.ToInt32(strFieldName.Substring(16, strFieldName.Length - 16)) - 1].blnUseCamper = Convert.ToBoolean(strFieldVal);
                            else if (strFieldName.IndexOf("blnUseProfileField") >= 0)
                                _cstWebFields[Convert.ToInt32(strFieldName.Substring(18, strFieldName.Length - 18)) - 1].blnUseProfile = Convert.ToBoolean(strFieldVal);
                            else if (strFieldName.IndexOf("blnUseProfileFlag") >= 0)
                                _cstWebFlags[Convert.ToInt32(strFieldName.Substring(17, strFieldName.Length - 17)) - 1].blnUseProfile = Convert.ToBoolean(strFieldVal);
                            else if (strFieldName.IndexOf("strField") >= 0)
                                _cstWebFields[Convert.ToInt32(strFieldName.Substring(8, strFieldName.Length - 8)) - 1].mmoWebCaption = strFieldVal;
                            else if (strFieldName.IndexOf("strFlag") >= 0)
                                _cstWebFlags[Convert.ToInt32(strFieldName.Substring(7, strFieldName.Length - 7)) - 1].mmoWebCaption = strFieldVal;
                        }
                    }
                }

                blnRes = true;
            }
            catch (Exception ex)
            {
                blnRes = false;
            }

            return blnRes;
        }
Ejemplo n.º 2
0
        private static void subStructureUpdateMDB()
        {
            string strErr = "";

            try
            {
                string strSQL = "";

                bool blnAddFields = false;

                using (OleDbConnection conCT = new OleDbConnection(clsAppSettings.GetAppSettings().strCTConn))
                {
                    conCT.Open();

                    strSQL = "SELECT strInformalSal " +
                            "FROM tblWebRecords";

                    using (OleDbCommand cmdCT = new OleDbCommand(strSQL, conCT))
                    {
                        blnAddFields = false;

                        try
                        {
                            cmdCT.CommandText = strSQL;

                            using (OleDbDataReader drSal = cmdCT.ExecuteReader(System.Data.CommandBehavior.SchemaOnly))
                            {
                                System.Data.DataTable dtSchema = drSal.GetSchemaTable();

                                int intSize = Convert.ToInt32(dtSchema.Rows[0]["ColumnSize"]);

                                if (intSize < 50) blnAddFields = true;

                                drSal.Close();
                            }
                        }
                        catch { blnAddFields = true; }

                        if (blnAddFields)
                        {
                            strSQL = "ALTER TABLE tblWebRecords ALTER COLUMN strInformalSal TEXT(50)";

                            cmdCT.CommandText = strSQL;

                            cmdCT.ExecuteNonQuery();
                        }

                        blnAddFields = false;

                        try
                        {
                            strSQL = "SELECT strHomePhone " +
                                    "FROM tblWebRecords";

                            cmdCT.CommandText = strSQL;

                            using (OleDbDataReader drHomePhone = cmdCT.ExecuteReader(System.Data.CommandBehavior.SchemaOnly))
                            {
                                System.Data.DataTable dtSchema = drHomePhone.GetSchemaTable();

                                int intSize = Convert.ToInt32(dtSchema.Rows[0]["ColumnSize"]);

                                if (intSize < 50) blnAddFields = true;

                                drHomePhone.Close();
                            }
                        }
                        catch { blnAddFields = true; }

                        if (blnAddFields)
                        {
                            strSQL = "ALTER TABLE tblWebRecords ALTER COLUMN strHomePhone TEXT(50)";

                            cmdCT.CommandText = strSQL;

                            cmdCT.ExecuteNonQuery();
                        }

                        if (!fcnAddField(cmdCT, "tblCampDefaults", "strEncPassPhrase", "TEXT(50)", "", ref strErr)) MessageBox.Show("There was an error adding tblCampDefaults.strEncPassPhrase:\n" + strErr);

                        if (!fcnAddField(cmdCT, "tblWebGift", "strAuthNum", "TEXT(50)", "", ref strErr)) MessageBox.Show("There was an error adding tblWebGift.strAuthNum:\n" + strErr);
                        blnAddFields = false;
                        if (!fcnAddField(cmdCT, "tblWebGift", "strPNRef", "TEXT(50)", "", ref strErr)) MessageBox.Show("There was an error adding tblWebGift.strPNRef:\n" + strErr);

                        if (!fcnAddField(cmdCT, "tblWebRecords", "blnParent", "YESNO", "", ref strErr)) MessageBox.Show("There was an error adding tblWebRecords.blnParent:\n" + strErr);
                        if (!fcnAddField(cmdCT, "tblWebRecords", "blnCamper", "YESNO", "", ref strErr)) MessageBox.Show("There was an error adding tblWebRecords.blnCamper:\n" + strErr);
                        if (!fcnAddField(cmdCT, "tblWebRecords", "intGradeCompleted", "LONG", "", ref strErr)) MessageBox.Show("There was an error adding tblWebRecords.intGradeCompleted:\n" + strErr);
                        if (!fcnAddField(cmdCT, "tblWebRecords", "intYearofGraduation", "LONG", "", ref strErr)) MessageBox.Show("There was an error adding tblWebRecords.intYearofGraduation:\n" + strErr);
                        if (!fcnAddField(cmdCT, "tblWebRecords", "lngConfMethodID", "LONG", "", ref strErr)) MessageBox.Show("There was an error adding tblWebRecords.lngConfMethodID:\n" + strErr);
                        if (!fcnAddField(cmdCT, "tblWebRecords", "lngProfileWebID", "LONG", "", ref strErr)) MessageBox.Show("There was an error adding tblWebRecords.lngProfileWebID:\n" + strErr);

                        //tables for ind event registrations
                        blnAddFields = false;

                        strSQL = "SELECT lngRegistrationBlockChoiceID " +
                                "FROM tblWebIndRegBlockChoices";

                        cmdCT.CommandText = strSQL;

                        try { cmdCT.ExecuteNonQuery(); }
                        catch { blnAddFields = true; }

                        if (blnAddFields)
                        {
                            strSQL = "CREATE TABLE tblWebIndRegBlockChoices " +
                                    "(lngRegistrationBlockChoiceID LONG CONSTRAINT pkRegBlockChoice PRIMARY KEY, " +
                                        "lngCTUserID LONG, " +
                                        "lngRegistrationWebID LONG, " +
                                        "lngBlockID LONG, " +
                                        "lngChoice LONG)";

                            cmdCT.CommandText = strSQL;
                            cmdCT.ExecuteNonQuery();

                            string strRegFlags = "";
                            string strRegFields = "";

                            for (int intI = 1; intI <= 30; intI++)
                            {
                                strRegFlags += "blnRegFlag" + intI.ToString() + " YESNO NULL, ";
                                strRegFields += "strRegField" + intI.ToString() + " TEXT(50), ";
                            }

                            strSQL = "CREATE TABLE tblWebIndRegistrations " +
                                    "( blnSpecialNeeds YESNO NULL, " + strRegFlags +
                                        "lngRegistrationWebID INT NOT NULL, lngRecordWebID int NOT NULL, lngConfMethodID int NULL, " +
                                        "curDeposit CURRENCY NULL , curDonation CURRENCY NULL , curSpendingMoney CURRENCY NULL , " +
                                        "dteRegistrationDate datetime NULL , dteCreated datetime NULL , " +
                                        "strBuddy1 TEXT (255)  NULL , strBuddy2 TEXT (255)  NULL , strReleaseTo TEXT (255)  NULL , strConfEmail TEXT (255) NULL , strReferredBy TEXT (50) NULL, strXCTransID TEXT (50)  NULL, strXCAlias TEXT (25) NULL, " + strRegFields +
                                        "strDependNotes MEMO NULL, mmoSpecialNeeds MEMO NULL, mmoRegNotes MEMO NULL )";

                            cmdCT.CommandText = strSQL;
                            cmdCT.ExecuteNonQuery();

                            strSQL = "CREATE TABLE tblWebTransactions " +
                                    "(lngTransactionWebID LONG CONSTRAINT pkTransactionWebID PRIMARY KEY, " +
                                    "lngCTUserID LONG, " +
                                    "blnProcessed YESNO, " +
                                    "lngTransactionID LONG, lngRecordID LONG, lngRecordWebID LONG, lngTransTypeID LONG, lngPaymentTypeID LONG, lngRegistrationID LONG, lngRegistrationWebID LONG, lngRegHoldID LONG, lngBillStateID LONG, lngThirdPartyID LONG, lngReversedTransactionID LONG, lngTransSubTypeID LONG, lngGGCCID LONG, lngGGCCRegistrationID LONG, lngThirdPartyTransID LONG, " +
                                    "curPayment CURRENCY, curCharge CURRENCY, " +
                                    "dteDateAdded DATETIME, " +
                                    "strCheckWriter TEXT(255), strCCNumber TEXT(255), strCCExpDate TEXT(255), strBillAddress TEXT(255), strBillCity TEXT(255), strBillName TEXT(255), strBillPhone TEXT(255), strBillZip TEXT(255), strCheckNumber TEXT(255), strTransactionDesc TEXT(255), strCCValCode TEXT(255), strAcctNum TEXT(255), strBankName TEXT(255), strRoutingNum TEXT(255), strAuthNumber TEXT(255), strPNRef TEXT(255))";

                            cmdCT.CommandText = strSQL;
                            cmdCT.ExecuteNonQuery();
                        }

                        //overhaul of web ind reg
                        blnAddFields = false;

                        strSQL = "SELECT blnRegFlag30 " +
                                "FROM tblWebIndRegistrations";

                        cmdCT.CommandText = strSQL;

                        try { cmdCT.ExecuteNonQuery(); }
                        catch { blnAddFields = true; }

                        if (blnAddFields)
                        {
                            strSQL = "DROP TABLE tblWebIndRegistrations";

                            cmdCT.CommandText = strSQL;

                            cmdCT.ExecuteNonQuery();

                            string strRegFlags = "";
                            string strRegFields = "";

                            for (int intI = 1; intI <= 30; intI++)
                            {
                                strRegFlags += "blnRegFlag" + intI.ToString() + " YESNO NULL, ";
                                strRegFields += "strRegField" + intI.ToString() + " TEXT(50), ";
                            }

                            strSQL = "CREATE TABLE tblWebIndRegistrations " +
                                    "( blnSpecialNeeds YESNO NULL, " + strRegFlags +
                                        "lngRegistrationWebID INT NOT NULL, lngRecordWebID int NOT NULL, lngConfMethodID int NULL, " +
                                        "curDeposit CURRENCY NULL , curDonation CURRENCY NULL , curSpendingMoney CURRENCY NULL , " +
                                        "dteRegistrationDate datetime NULL , dteCreated datetime NULL , " +
                                        "strBuddy1 TEXT (255)  NULL , strBuddy2 TEXT (255)  NULL , strReleaseTo TEXT (255)  NULL , strConfEmail TEXT (255) NULL , strReferredBy TEXT (50) NULL, strXCTransID TEXT (50)  NULL , strXCAlias TEXT (25) NULL, " + strRegFields +
                                        "strDependNotes MEMO NULL, mmoSpecialNeeds MEMO NULL, mmoRegNotes MEMO NULL )";

                            cmdCT.CommandText = strSQL;

                            cmdCT.ExecuteNonQuery();
                        }

                        //tlkpCountries
                        blnAddFields = false;

                        strSQL = "SELECT lngCountryID " +
                                "FROM tlkpCountry ";

                        cmdCT.CommandText = strSQL;

                        try { cmdCT.ExecuteNonQuery(); }
                        catch { blnAddFields = true; }

                        if (blnAddFields)
                        {
                            strSQL = "CREATE TABLE tlkpCountry " +
                                    "( lngCountryID INT NOT NULL, " +
                                        "strCountry TEXT (50) )";

                            cmdCT.CommandText = strSQL;

                            cmdCT.ExecuteNonQuery();

                            //populate country table
                            subPopCountries();
                        }

                        if (!fcnAddField(cmdCT, "tblCampDefaults", "strXChargeTerminalID", "TEXT(50)", "", ref strErr)) MessageBox.Show("There was an error adding tblCampDefaults.strXChargeTerminalID:\n" + strErr);
                        if (!fcnAddField(cmdCT, "tblCampDefaults", "strPCIAgreementCode", "TEXT(15)", "", ref strErr)) MessageBox.Show("There was an error adding tblCampDefaults.strPCIAgreementCode:\n" + strErr);
                        if (!fcnAddField(cmdCT, "tblCampDefaults", "strPCIAgreementKey", "TEXT(15)", "", ref strErr)) MessageBox.Show("There was an error adding tblCampDefaults.strPCIAgreementKey:\n" + strErr);

                        if (!fcnAddField(cmdCT, "tblGGCCRegistrations", "strPNRef", "TEXT(50)", "", ref strErr)) MessageBox.Show("There was an error adding tblGGCCRegistrations.strPNRef:\n" + strErr);
                        if (!fcnAddField(cmdCT, "tblWebGGCCRegistrations", "strPNRef", "TEXT(50)", "", ref strErr)) MessageBox.Show("There was an error adding tblWebGGCCRegistrations.strPNRef:\n" + strErr);
                        if (!fcnAddField(cmdCT, "tblBillingInfo", "strPNRef", "TEXT(50)", "", ref strErr)) MessageBox.Show("There was an error adding tblBillingInfo.strPNRef:\n" + strErr);
                        if (!fcnAddField(cmdCT, "tblBillingInfo", "strPrevTransType", "TEXT(50)", "", ref strErr)) MessageBox.Show("There was an error adding tblBillingInfo.strPrevTransType:\n" + strErr);

                        if (!fcnAddField(cmdCT, "tblCampDefaults", "strTextClientID", "TEXT(50)", "", ref strErr)) MessageBox.Show("There was an error adding tblCampDefaults.strTextClientID:\n" + strErr);
                        if (!fcnAddField(cmdCT, "tblCampDefaults", "strMDCustomerID", "TEXT(50)", "", ref strErr)) MessageBox.Show("There was an error adding tblCampDefaults.strMDCustomerID:\n" + strErr);
                        if (!fcnAddField(cmdCT, "tblCampDefaults", "blnCapsWebProcessing", "YESNO", "", ref strErr)) MessageBox.Show("There was an error adding tblCampDefaults.blnCapsWebProcessing:\n" + strErr);

                        //cert results table for melissa data ncoa
                        blnAddFields = false;

                        strSQL = "SELECT lngRecordID " +
                                "FROM tblRecordCert";

                        cmdCT.CommandText = strSQL;

                        try { cmdCT.ExecuteNonQuery(); }
                        catch { blnAddFields = true; }

                        if (blnAddFields)
                        {
                            //try drop first (just in case it was created incorrectly)
                            strSQL = "DROP TABLE tblRecordCert";

                            cmdCT.CommandText = strSQL;

                            try { cmdCT.ExecuteNonQuery(); }
                            catch { }

                            strSQL = "CREATE TABLE tblRecordCert " +
                                        "( lngRecordID LONG CONSTRAINT PK_lngRecordID PRIMARY KEY, " +
                                            "dteProcessed DATETIME, " +
                                            "strErrorCode TEXT(10), " +
                                            "strErrorDesc TEXT(50), " +
                                            "strStatus TEXT(50), " +
                                            "strMoveDate TEXT(50), " +
                                            "strMoveReturnCode TEXT(25), " +
                                            "strMoveReturnDesc TEXT(100), " +
                                            "strMoveTypeCode TEXT(50), " +
                                            "strMoveTypeDesc TEXT(50), " +
                                            "strListName TEXT(25))";

                            cmdCT.CommandText = strSQL;

                            cmdCT.ExecuteNonQuery();
                        }

                        //tblDiscounts (promo codes)
                        blnAddFields = false;

                        strSQL = "SELECT lngDiscountDefID " +
                                "FROM tblDiscountDefs";

                        cmdCT.CommandText = strSQL;

                        try { cmdCT.ExecuteNonQuery(); }
                        catch { blnAddFields = true; }

                        if (blnAddFields)
                        {
                            //try drop first (just in case it was created incorrectly)
                            strSQL = "DROP TABLE tblDiscountDefs";

                            cmdCT.CommandText = strSQL;

                            try { cmdCT.ExecuteNonQuery(); }
                            catch { }

                            strSQL = "CREATE TABLE tblDiscountDefs " +
                                        "( lngDiscountDefID COUNTER CONSTRAINT PK_lngDiscountDefID PRIMARY KEY, " +
                                            "lngDiscountDefWebID INT NULL, " +
                                            "lngDiscountID INT NULL, " +
                                            "strPromoCode TEXT(50))";

                            cmdCT.CommandText = strSQL;

                            cmdCT.ExecuteNonQuery();
                        }

                        //customer ref, pmt method for vanco processing
                        blnAddFields = false;

                        strSQL = "SELECT strVancoCustRef " +
                                "FROM tblWebGGCCRegistrations";

                        cmdCT.CommandText = strSQL;

                        try { cmdCT.ExecuteNonQuery(); }
                        catch { blnAddFields = true; }

                        if (blnAddFields)
                        {
                            strSQL = "ALTER TABLE tblWebGGCCRegistrations " +
                                    "ADD COLUMN strVancoCustRef TEXT(50)";

                            cmdCT.CommandText = strSQL;

                            cmdCT.ExecuteNonQuery();

                            strSQL = "ALTER TABLE tblWebGGCCRegistrations " +
                                    "ADD COLUMN strVancoPmtMethID TEXT(50)";

                            cmdCT.CommandText = strSQL;

                            cmdCT.ExecuteNonQuery();
                        }

                        //NCOA IDs to process
                        blnAddFields = false;

                        strSQL = "SELECT lngRecordID " +
                                "FROM tblNCOAIDsToProcess";

                        cmdCT.CommandText = strSQL;

                        try { cmdCT.ExecuteNonQuery(); }
                        catch { blnAddFields = true; }

                        if (blnAddFields)
                        {
                            strSQL = "CREATE TABLE tblNCOAIDsToProcess " +
                                    "(lngRecordID LONG CONSTRAINT pkRecordID PRIMARY KEY)";

                            cmdCT.CommandText = strSQL;

                            cmdCT.ExecuteNonQuery();
                        }

                        //ID holder for chunked upload
                        blnAddFields = false;

                        strSQL = "SELECT lngID " +
                                "FROM tblIDHolder";

                        cmdCT.CommandText = strSQL;

                        try { cmdCT.ExecuteNonQuery(); }
                        catch { blnAddFields = true; }

                        if (blnAddFields)
                        {
                            strSQL = "CREATE TABLE tblIDHolder " +
                                    "(lngID LONG CONSTRAINT pkID PRIMARY KEY)";

                            cmdCT.CommandText = strSQL;

                            cmdCT.ExecuteNonQuery();
                        }

                        //strAddress
                        //strCity
                        //strState
                        //strZip
                        blnAddFields = false;

                        strSQL = "SELECT strAddress " +
                                "FROM tblRecordCert";

                        cmdCT.CommandText = strSQL;

                        try { cmdCT.ExecuteNonQuery(); }
                        catch { blnAddFields = true; }

                        if (blnAddFields)
                        {
                            strSQL = "ALTER TABLE tblRecordCert " +
                                    "ADD COLUMN strAddress TEXT(255)";

                            cmdCT.CommandText = strSQL;

                            cmdCT.ExecuteNonQuery();

                            strSQL = "ALTER TABLE tblRecordCert " +
                                    "ADD COLUMN strCity TEXT(255)";

                            cmdCT.CommandText = strSQL;

                            cmdCT.ExecuteNonQuery();

                            strSQL = "ALTER TABLE tblRecordCert " +
                                    "ADD COLUMN strState TEXT(25)";

                            cmdCT.CommandText = strSQL;

                            cmdCT.ExecuteNonQuery();

                            strSQL = "ALTER TABLE tblRecordCert " +
                                    "ADD COLUMN strZip TEXT(25)";

                            cmdCT.CommandText = strSQL;

                            cmdCT.ExecuteNonQuery();
                        }

                        //tblMORNCOAAlerts
                        blnAddFields = false;

                        strSQL = "SELECT lngMORID " +
                                "FROM tblMORNCOAAlerts";

                        cmdCT.CommandText = strSQL;

                        try { cmdCT.ExecuteNonQuery(); }
                        catch { blnAddFields = true; }

                        if (blnAddFields)
                        {
                            strSQL = "CREATE TABLE tblMORNCOAAlerts " +
                                    "(lngMORID LONG CONSTRAINT pkMORID PRIMARY KEY, " +
                                        "blnResolved YESNO, " +
                                        "strListName TEXT(50), " +
                                        "mmoAlertNotes MEMO)";

                            cmdCT.CommandText = strSQL;

                            cmdCT.ExecuteNonQuery();
                        }

                        //tblRecordCert.blnReconciled
                        blnAddFields = false;

                        strSQL = "SELECT blnReconciled " +
                                "FROM tblRecordCert";

                        cmdCT.CommandText = strSQL;

                        try { cmdCT.ExecuteNonQuery(); }
                        catch { blnAddFields = true; }

                        if (blnAddFields)
                        {
                            strSQL = "ALTER TABLE tblRecordCert " +
                                    "ADD COLUMN blnReconciled YESNO";

                            cmdCT.CommandText = strSQL;

                            cmdCT.ExecuteNonQuery();
                        }

                        //tblCampDefaults.blnUseSSL
                        blnAddFields = false;

                        strSQL = "SELECT blnUseSSL " +
                                "FROM tblCampDefaults";

                        cmdCT.CommandText = strSQL;

                        try { cmdCT.ExecuteNonQuery(); }
                        catch { blnAddFields = true; }

                        if (blnAddFields)
                        {
                            strSQL = "ALTER TABLE tblCampDefaults " +
                                    "ADD COLUMN blnUseSSL YESNO";

                            cmdCT.CommandText = strSQL;

                            cmdCT.ExecuteNonQuery();
                        }

                        //transaction dl batches
                        blnAddFields = false;

                        strSQL = "SELECT lngTransactionID " +
                                "FROM tblTransDLBatches";

                        cmdCT.CommandText = strSQL;

                        try { cmdCT.ExecuteNonQuery(); }
                        catch { blnAddFields = true; }

                        if (blnAddFields)
                        {
                            //try drop first (just in case it was created incorrectly)
                            strSQL = "DROP TABLE tblTransDLBatches";

                            cmdCT.CommandText = strSQL;

                            try { cmdCT.ExecuteNonQuery(); }
                            catch { }

                            strSQL = "CREATE TABLE tblTransDLBatches " +
                                        "( lngTransactionID LONG CONSTRAINT PK_lngTransactionID PRIMARY KEY, " +
                                            "dteRetrieved DATETIME )";

                            cmdCT.CommandText = strSQL;

                            cmdCT.ExecuteNonQuery();
                        }

                        //tblGoogleCalOptions
                        blnAddFields = false;

                        strSQL = "SELECT blnULGG " +
                                "FROM tblGoogleCalOptions";

                        cmdCT.CommandText = strSQL;

                        try { cmdCT.ExecuteNonQuery(); }
                        catch { blnAddFields = true; }

                        if (blnAddFields)
                        {
                            strSQL = "CREATE TABLE tblGoogleCalOptions " +
                                    "(blnULGG YESNO, blnULCC YESNO, blnULBlock YESNO, blnFilterByProgramGG YESNO, blnFilterByProgramCC YESNO, blnFilterByProgramBlock YESNO, blnFilterByStartDateGG YESNO, blnFilterByStartDateCC YESNO, blnFilterByStartDateBlock YESNO, blnFilterByStatusGG YESNO, blnFilterByStatusCC YESNO, " +
                                        "dteStartDateGG DATETIME, dteStartDateCC DATETIME, dteStartDateBlock DATETIME, dteEndDateGG DATETIME, dteEndDateCC DATETIME, dteEndDateBlock DATETIME)";

                            cmdCT.CommandText = strSQL;
                            cmdCT.ExecuteNonQuery();

                            strSQL = "INSERT INTO tblGoogleCalOptions " +
                                    "(blnULGG, blnULCC, blnULBlock, blnFilterByProgramGG, blnFilterByProgramCC, blnFilterByProgramBlock, blnFilterByStartDateGG, blnFilterByStartDateCC, blnFilterByStartDateBlock, blnFilterByStatusGG, blnFilterByStatusCC, " +
                                        "dteStartDateGG, dteStartDateCC, dteStartDateBlock, dteEndDateGG, dteEndDateCC, dteEndDateBlock) " +
                                    "VALUES " +
                                    "(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, " +
                                        "Now(), Now(), Now(), Now(), Now(), Now())";

                            cmdCT.CommandText = strSQL;
                            cmdCT.ExecuteNonQuery();

                            strSQL = "CREATE TABLE tblGoogleCalFilteredPrograms " +
                                    "(lngProgramTypeID LONG)";

                            cmdCT.CommandText = strSQL;
                            cmdCT.ExecuteNonQuery();

                            strSQL = "CREATE TABLE tblGoogleCalFilteredStatus " +
                                    "(lngStatusID LONG)";

                            cmdCT.CommandText = strSQL;
                            cmdCT.ExecuteNonQuery();
                        }

                        //tblCustomFieldsGiftDef
                        blnAddFields = false;

                        strSQL = "SELECT strFieldName " +
                                "FROM tblCustomFieldsGiftDef";

                        cmdCT.CommandText = strSQL;

                        try { cmdCT.ExecuteNonQuery(); }
                        catch { blnAddFields = true; }

                        if (blnAddFields)
                        {
                            strSQL = "CREATE TABLE tblCustomFieldsGiftDef " +
                                    "(blnRequired YESNO, " +
                                        "strFieldName TEXT(50), strFieldDesc TEXT(255), strFieldType TEXT(20), strDefaultVal TEXT(255), strValidation TEXT(10))";

                            cmdCT.Parameters.Clear();
                            cmdCT.CommandText = strSQL;

                            cmdCT.ExecuteNonQuery();
                        }

                        //tblCustomFieldsGiftLookupOptions
                        blnAddFields = false;

                        strSQL = "SELECT strFieldName " +
                                "FROM tblCustomFieldsGiftLookupOptions";

                        cmdCT.CommandText = strSQL;

                        try { cmdCT.ExecuteNonQuery(); }
                        catch { blnAddFields = true; }

                        if (blnAddFields)
                        {
                            strSQL = "CREATE TABLE tblCustomFieldsGiftLookupOptions " +
                                    "(intSortOrder INTEGER, " +
                                        "strFieldName TEXT(50), strLookupOption TEXT(255), " +
                                        "Primary key (strFieldName, strLookupOption))";

                            cmdCT.Parameters.Clear();
                            cmdCT.CommandText = strSQL;

                            cmdCT.ExecuteNonQuery();
                        }

                        //tblDonorExpress
                        blnAddFields = false;

                        strSQL = "SELECT lngDonorExpressID " +
                                "FROM tblDonorExpress";

                        cmdCT.CommandText = strSQL;

                        try { cmdCT.ExecuteNonQuery(); }
                        catch { blnAddFields = true; }

                        if (blnAddFields)
                        {
                            strSQL = "CREATE TABLE tblDonorExpress " +
                                    "(lngDonorExpressID LONG CONSTRAINT lngDonorExpressID_PK PRIMARY KEY, " +
                                        "blnProcessed YESNO DEFAULT 0, " +
                                        "lngPaymentTypeID LONG, " +
                                        "dteCreated DATETIME, dteSubmitted DATETIME, " +
                                        "curGiftAmt CURRENCY, " +
                                        "strEmail TEXT(255), strFName TEXT(50), strLName TEXT(50), strAddress TEXT(100), strCity TEXT(50), strState TEXT(20), strZip TEXT(50), strHomePhone TEXT(20), strReferredBy TEXT(50), strIMO TEXT(50), strIHO TEXT(50), strCheckNumber TEXT(50), strAcctNum TEXT(255), strBankName TEXT(255), strCCExpDate TEXT(4), strCCNumber TEXT(100), strCCValCode TEXT(10), strRoutingNum TEXT(255), strAuthNum TEXT(50), strPNRef TEXT(50), strXCAlias TEXT(50), strXCTransID TEXT(50), strXCEFTAuthCode TEXT(50), strXCEFTRefID TEXT(50))";

                            cmdCT.Parameters.Clear();
                            cmdCT.CommandText = strSQL;

                            cmdCT.ExecuteNonQuery();

                            strSQL = "CREATE TABLE tblDonorExpressCustomVals " +
                                    "(lngDonorExpressID LONG, " +
                                        "strFieldName TEXT(50), " +
                                        "strValue MEMO, " +
                                        "PRIMARY KEY (lngDonorExpressID, strFieldName))";

                            cmdCT.Parameters.Clear();
                            cmdCT.CommandText = strSQL;

                            cmdCT.ExecuteNonQuery();

                            strSQL = "CREATE TABLE tblDXDonorCustomVals " +
                                    "(lngDonorExpressID LONG, " +
                                        "strFieldName TEXT(50), " +
                                        "strValue MEMO, " +
                                        "PRIMARY KEY (lngDonorExpressID, strFieldName))";

                            cmdCT.Parameters.Clear();
                            cmdCT.CommandText = strSQL;

                            cmdCT.ExecuteNonQuery();
                        }

                        blnAddFields = false;

                        strSQL = "SELECT lngCustomFieldValWebIRID " +
                                "FROM tblCustomFieldValWebIR";

                        cmdCT.CommandText = strSQL;
                        cmdCT.Parameters.Clear();

                        try { cmdCT.ExecuteNonQuery(); }
                        catch { blnAddFields = true; }

                        if (blnAddFields)
                        {
                            //tblCustomFieldValWebIR
                            strSQL = "CREATE TABLE tblCustomFieldValWebIR " +
                                    "( lngCustomFieldValWebIRID COUNTER CONSTRAINT lngCustomFieldValWebIRID_PK PRIMARY KEY, " +
                                        "lngRecordWebID LONG, " +
                                        "strLocalCaption TEXT(255), " +
                                        "strValue MEMO )";

                            cmdCT.Parameters.Clear();
                            cmdCT.CommandText = strSQL;

                            try { cmdCT.ExecuteNonQuery(); }
                            catch (Exception ex) { MessageBox.Show("Error adding tblCustomFieldValIR: " + ex.Message); }

                            //append default records to tblCustomFieldDefIR (only used when first creating new structure)
                            strSQL = "SELECT tblCustomFlagDesc.* " +
                                    "FROM tblCustomFlagDesc";

                            cmdCT.CommandText = strSQL;
                            cmdCT.Parameters.Clear();

                            using (OleDbDataReader drCust = cmdCT.ExecuteReader())
                            {
                                if (drCust.Read())
                                {
                                    bool blnUse = false;
                                    string strVal = "";

                                    using (OleDbConnection conAppendDB = new OleDbConnection(clsAppSettings.GetAppSettings().strCTConn))
                                    {
                                        conAppendDB.Open();

                                        using (OleDbCommand cmdAppend = new OleDbCommand())
                                        {
                                            cmdAppend.Connection = conAppendDB;

                                            int intSort = 0;

                                            for (int intI = 1; intI <= 30; intI++)
                                            {
                                                //flag
                                                try { blnUse = Convert.ToBoolean(drCust["blnFlag" + intI.ToString()]); }
                                                catch { blnUse = false; }

                                                try { strVal = Convert.ToString(drCust["strFlag" + intI.ToString() + "Desc"]); }
                                                catch { strVal = ""; }

                                                if (blnUse && strVal != "")
                                                {
                                                    intSort++;

                                                    strSQL = "DELETE FROM tblCustomFieldValWebIR";

                                                    cmdAppend.CommandText = strSQL;
                                                    cmdAppend.Parameters.Clear();

                                                    try { cmdAppend.ExecuteNonQuery(); }
                                                    catch { }

                                                    //add web records to val table
                                                    strSQL = "INSERT INTO tblCustomFieldValWebIR " +
                                                            "( lngRecordWebID, " +
                                                                "strLocalCaption, strValue ) " +
                                                            "SELECT tblWebRecords.lngRecordWebID, " +
                                                                "@strLocalCaption AS strLocalCaption, tblWebRecords.blnFlag" + intI.ToString() + " " +
                                                            "FROM tblWebRecords;";

                                                    cmdAppend.Parameters.Clear();
                                                    cmdAppend.CommandText = strSQL;

                                                    cmdAppend.Parameters.AddWithValue("@strLocalCaption", strVal);

                                                    try { cmdAppend.ExecuteNonQuery(); }
                                                    catch { }
                                                }

                                                //field
                                                try { blnUse = Convert.ToBoolean(drCust["blnField" + intI.ToString()]); }
                                                catch { blnUse = false; }

                                                try { strVal = Convert.ToString(drCust["strField" + intI.ToString() + "Desc"]); }
                                                catch { strVal = ""; }

                                                if (blnUse && strVal != "")
                                                {
                                                    intSort++;

                                                    //add web records to val table
                                                    strSQL = "INSERT INTO tblCustomFieldValWebIR " +
                                                            "( lngRecordWebID, " +
                                                                "strLocalCaption, strValue ) " +
                                                            "SELECT tblWebRecords.lngRecordWebID, " +
                                                                "@strLocalCaption AS strLocalCaption, tblWebRecords.strCustom" + intI.ToString() + " " +
                                                            "FROM tblWebRecords";

                                                    cmdAppend.Parameters.Clear();
                                                    cmdAppend.CommandText = strSQL;

                                                    cmdAppend.Parameters.AddWithValue("@strLocalCaption", strVal);

                                                    try { cmdAppend.ExecuteNonQuery(); }
                                                    catch { }
                                                }
                                            }
                                        }

                                        conAppendDB.Close();
                                    }
                                }

                                drCust.Close();
                            }
                        }

                        //web reg
                        blnAddFields = false;

                        strSQL = "SELECT lngCustomFieldValWebRegID " +
                                "FROM tblCustomFieldValWebReg";

                        cmdCT.CommandText = strSQL;
                        cmdCT.Parameters.Clear();

                        try { cmdCT.ExecuteNonQuery(); }
                        catch { blnAddFields = true; }

                        if (blnAddFields)
                        {
                            //tblCustomFieldValWebReg
                            strSQL = "CREATE TABLE tblCustomFieldValWebReg " +
                                    "( lngCustomFieldValWebRegID COUNTER CONSTRAINT lngCustomFieldValWebRegID_PK PRIMARY KEY, " +
                                        "lngRegistrationWebID LONG, " +
                                        "strLocalCaption TEXT(255), " +
                                        "strValue MEMO )";

                            cmdCT.Parameters.Clear();
                            cmdCT.CommandText = strSQL;

                            try { cmdCT.ExecuteNonQuery(); }
                            catch (Exception ex) { MessageBox.Show("Error adding tblCustomFieldValReg: " + ex.Message); }

                            //append default records to tblCustomFieldDefReg
                            strSQL = "SELECT tblCustomRegFlagDesc.* " +
                                    "FROM tblCustomRegFlagDesc";

                            cmdCT.CommandText = strSQL;
                            cmdCT.Parameters.Clear();

                            using (OleDbDataReader drCust = cmdCT.ExecuteReader())
                            {
                                if (drCust.Read())
                                {
                                    bool blnUse = false;
                                    string strVal = "";

                                    using (OleDbConnection conAppendDB = new OleDbConnection(clsAppSettings.GetAppSettings().strCTConn))
                                    {
                                        conAppendDB.Open();

                                        using (OleDbCommand cmdAppend = new OleDbCommand())
                                        {
                                            cmdAppend.Connection = conAppendDB;

                                            int intSort = 0;

                                            for (int intI = 1; intI <= 30; intI++)
                                            {
                                                //flag
                                                try { blnUse = Convert.ToBoolean(drCust["blnFlag" + intI.ToString()]); }
                                                catch { blnUse = false; }

                                                try { strVal = Convert.ToString(drCust["strFlag" + intI.ToString() + "Desc"]); }
                                                catch { strVal = ""; }

                                                if (blnUse && strVal != "")
                                                {
                                                    intSort++;

                                                    //add web records to val table
                                                    strSQL = "INSERT INTO tblCustomFieldValWebReg " +
                                                            "( lngRegistrationWebID, " +
                                                                "strLocalCaption, strValue ) " +
                                                            "SELECT tblWebIndRegistrations.lngRegistrationWebID, " +
                                                                "@strLocalCaption AS strLocalCaption, tblWebIndRegistrations.blnRegFlag" + intI.ToString() + " " +
                                                            "FROM tblWebIndRegistrations " +
                                                            "WHERE @strLocalCaption IN " +
                                                                "(SELECT strLocalCaption " +
                                                                "FROM tblCustomFieldDefReg " +
                                                                "WHERE blnUseOnline=True)";

                                                    cmdAppend.Parameters.Clear();
                                                    cmdAppend.CommandText = strSQL;

                                                    cmdAppend.Parameters.AddWithValue("@strLocalCaption", strVal);

                                                    try { cmdAppend.ExecuteNonQuery(); }
                                                    catch { }
                                                }

                                                //field
                                                try { blnUse = Convert.ToBoolean(drCust["blnField" + intI.ToString()]); }
                                                catch { blnUse = false; }

                                                try { strVal = Convert.ToString(drCust["strField" + intI.ToString() + "Desc"]); }
                                                catch { strVal = ""; }

                                                if (blnUse && strVal != "")
                                                {
                                                    intSort++;

                                                    //add web records to val table
                                                    strSQL = "INSERT INTO tblCustomFieldValWebReg " +
                                                            "( lngRegistrationWebID, " +
                                                                "strLocalCaption, strValue ) " +
                                                            "SELECT tblWebIndRegistrations.lngRegistrationWebID, " +
                                                                "@strLocalCaption AS strLocalCaption, tblWebIndRegistrations.strRegField" + intI.ToString() + " " +
                                                            "FROM tblWebIndRegistrations " +
                                                            "WHERE @strLocalCaption IN " +
                                                                "(SELECT strLocalCaption " +
                                                                "FROM tblCustomFieldDefReg " +
                                                                "WHERE blnUseOnline=True)";

                                                    cmdAppend.Parameters.Clear();
                                                    cmdAppend.CommandText = strSQL;

                                                    cmdAppend.Parameters.AddWithValue("@strLocalCaption", strVal);

                                                    try { cmdAppend.ExecuteNonQuery(); }
                                                    catch { }
                                                }
                                            }
                                        }

                                        conAppendDB.Close();
                                    }
                                }

                                drCust.Close();
                            }
                        }

                        //tblCustomFieldDefIR
                        blnAddFields = false;

                        strSQL = "SELECT lngCustomFieldDefIRID " +
                                "FROM tblCustomFieldDefIR";

                        cmdCT.CommandText = strSQL;

                        try { cmdCT.ExecuteNonQuery(); }
                        catch { blnAddFields = true; }

                        if (blnAddFields)
                        {
                            //get web field, flag defs
                            clsCustomFieldIRDef[] cstWebFlags = new clsCustomFieldIRDef[30];
                            clsCustomFieldIRDef[] cstWebFields = new clsCustomFieldIRDef[30];

                            if (!fcnGetWebCustomFieldDefs(cstWebFlags, cstWebFields)) MessageBox.Show("There was an error retrieving web custom field defs");

                            strSQL = "CREATE TABLE tblCustomFieldDefIR " +
                                    "(lngCustomFieldDefIRID COUNTER CONSTRAINT lngCustomFieldDefIRID_PK PRIMARY KEY, " +
                                        "blnRequired YESNO DEFAULT 0, " +
                                        "blnUseLocal YESNO DEFAULT 0, " +
                                        "lngProgramID LONG, " +
                                        "lngSortOrder LONG, " +
                                        "strLocalCaption TEXT(255), " +
                                        "strFieldType TEXT(25))";

                            cmdCT.Parameters.Clear();
                            cmdCT.CommandText = strSQL;

                            try { cmdCT.ExecuteNonQuery(); }
                            catch (Exception ex) { MessageBox.Show("Error adding tblCustomFieldDefIR: " + ex.Message); }

                            //tblCustomFieldValIR
                            strSQL = "CREATE TABLE tblCustomFieldValIR " +
                                    "( lngCustomFieldValIRID COUNTER CONSTRAINT lngCustomFieldValIRID_PK PRIMARY KEY, " +
                                        "lngRecordID LONG, " +
                                        "strLocalCaption TEXT(255), " +
                                        "strValue MEMO )";

                            cmdCT.Parameters.Clear();
                            cmdCT.CommandText = strSQL;

                            try { cmdCT.ExecuteNonQuery(); }
                            catch (Exception ex) { MessageBox.Show("Error adding tblCustomFieldValIR: " + ex.Message); }

                            //append default records to tblCustomFieldDefIR (only used when first creating new structure)
                            strSQL = "SELECT tblCustomFlagDesc.* " +
                                    "FROM tblCustomFlagDesc";

                            cmdCT.CommandText = strSQL;
                            cmdCT.Parameters.Clear();

                            using (OleDbDataReader drCust = cmdCT.ExecuteReader())
                            {
                                if (drCust.Read())
                                {
                                    bool blnUse = false;
                                    string strVal = "";

                                    using (OleDbConnection conAppendDB = new OleDbConnection(clsAppSettings.GetAppSettings().strCTConn))
                                    {
                                        conAppendDB.Open();

                                        using (OleDbCommand cmdAppend = new OleDbCommand())
                                        {
                                            cmdAppend.Connection = conAppendDB;

                                            int intSort = 0;

                                            for (int intI = 1; intI <= 30; intI++)
                                            {
                                                //flag
                                                try { blnUse = Convert.ToBoolean(drCust["blnFlag" + intI.ToString()]); }
                                                catch { blnUse = false; }

                                                try { strVal = Convert.ToString(drCust["strFlag" + intI.ToString() + "Desc"]); }
                                                catch { strVal = ""; }

                                                if (blnUse && strVal != "")
                                                {
                                                    intSort++;

                                                    strSQL = "INSERT INTO tblCustomFieldDefIR " +
                                                            "( blnUseLocal, " +
                                                                "lngSortOrder, " +
                                                                "strLocalCaption, strFieldType ) " +
                                                            "VALUES " +
                                                            "( 1, " +
                                                                intSort.ToString() + ", " +
                                                                "@strLocalCaption, 'FLAG', @mmoWebCaption)";

                                                    cmdAppend.CommandText = strSQL;
                                                    cmdAppend.Parameters.Clear();

                                                    cmdAppend.Parameters.AddWithValue("@strLocalCaption", strVal);

                                                    try { cmdAppend.ExecuteNonQuery(); }
                                                    catch (Exception ex) { MessageBox.Show("Error converting data into tblCustomFieldDefIR: " + ex.Message); }

                                                    //add records to val table
                                                    strSQL = "INSERT INTO tblCustomFieldValIR " +
                                                            "( lngRecordID, " +
                                                                "strLocalCaption, strValue ) " +
                                                            "SELECT tblRecords.lngRecordID, " +
                                                                "@strLocalCaption AS strLocalCaption, tblRecords.blnFlag" + intI.ToString() + " " +
                                                            "FROM tblRecords";

                                                    cmdAppend.Parameters.Clear();
                                                    cmdAppend.CommandText = strSQL;

                                                    cmdAppend.Parameters.AddWithValue("@strLocalCaption", strVal);

                                                    try { cmdAppend.ExecuteNonQuery(); }
                                                    catch (Exception ex) { MessageBox.Show("There was an error adding custom field values: " + ex.Message); }
                                                }

                                                //field
                                                try { blnUse = Convert.ToBoolean(drCust["blnField" + intI.ToString()]); }
                                                catch { blnUse = false; }

                                                try { strVal = Convert.ToString(drCust["strField" + intI.ToString() + "Desc"]); }
                                                catch { strVal = ""; }

                                                if (blnUse && strVal != "")
                                                {
                                                    intSort++;

                                                    strSQL = "INSERT INTO tblCustomFieldDefIR " +
                                                            "( blnUseLocal, " +
                                                                "lngSortOrder, " +
                                                                "strLocalCaption, strFieldType ) " +
                                                            "VALUES " +
                                                            "( 1, " +
                                                                intSort.ToString() + ", " +
                                                                "@strLocalCaption, 'FIELD')";

                                                    cmdAppend.CommandText = strSQL;
                                                    cmdAppend.Parameters.Clear();

                                                    cmdAppend.Parameters.AddWithValue("@strLocalCaption", strVal);

                                                    try { cmdAppend.ExecuteNonQuery(); }
                                                    catch (Exception ex) { MessageBox.Show("Error converting data into tblCustomFieldDefIR: " + ex.Message); }

                                                    //add records to val table
                                                    strSQL = "INSERT INTO tblCustomFieldValIR " +
                                                            "( lngRecordID, " +
                                                                "strLocalCaption, strValue ) " +
                                                            "SELECT tblRecords.lngRecordID, " +
                                                                "@strLocalCaption AS strLocalCaption, tblRecords.strCustom" + intI.ToString() + " " +
                                                            "FROM tblRecords " +
                                                            "WHERE strCustom" + intI.ToString() + "<>''";

                                                    cmdAppend.Parameters.Clear();
                                                    cmdAppend.CommandText = strSQL;

                                                    cmdAppend.Parameters.AddWithValue("@strLocalCaption", strVal);

                                                    try { cmdAppend.ExecuteNonQuery(); }
                                                    catch { }
                                                }
                                            }
                                        }

                                        conAppendDB.Close();
                                    }
                                }

                                drCust.Close();
                            }
                        }

                        ////////////////////////Custom Registration Fields//////////////////////////////////////////////////

                        //tblCustomRegFieldDefIR
                        blnAddFields = false;

                        strSQL = "SELECT lngCustomFieldDefRegID " +
                                "FROM tblCustomFieldDefReg";

                        cmdCT.CommandText = strSQL;

                        try { cmdCT.ExecuteNonQuery(); }
                        catch { blnAddFields = true; }

                        if (blnAddFields)
                        {
                            //get web field, flag defs
                           clsCustomFieldRegDef[] cstWebRegFlags = new clsCustomFieldRegDef[30];
                           clsCustomFieldRegDef[] cstWebRegFields = new clsCustomFieldRegDef[30];

                            if (!fcnGetWebCustomRegFieldDefs(cstWebRegFlags,cstWebRegFields)) MessageBox.Show("There was an error retrieving web custom reg field defs");

                            strSQL = "CREATE TABLE tblCustomFieldDefReg " +
                                    "(lngCustomFieldDefRegID COUNTER CONSTRAINT lngCustomFieldDefRegID_PK PRIMARY KEY, " +
                                        "blnRequired YESNO DEFAULT 0, " +
                                        "blnUseLocal YESNO DEFAULT 0, " +
                                        "lngProgramID LONG, " +
                                        "lngSortOrder LONG, " +
                                        "decCharge CURRENCY, " +
                                        "strLocalCaption TEXT(255), " +
                                        "strFieldType TEXT(25))";

                            cmdCT.Parameters.Clear();
                            cmdCT.CommandText = strSQL;

                            try { cmdCT.ExecuteNonQuery(); }
                            catch (Exception ex) { MessageBox.Show("Error adding tblCustomFieldDefReg: " + ex.Message); }

                            //tblCustomFieldValReg
                            strSQL = "CREATE TABLE tblCustomFieldValReg " +
                                    "( lngCustomFieldValRegID COUNTER CONSTRAINT lngCustomFieldValRegID_PK PRIMARY KEY, " +
                                        "lngRegistrationID LONG, " +
                                        "strLocalCaption TEXT(255), " +
                                        "strValue MEMO )";

                            cmdCT.Parameters.Clear();
                            cmdCT.CommandText = strSQL;

                            try { cmdCT.ExecuteNonQuery(); }
                            catch (Exception ex) { MessageBox.Show("Error adding tblCustomFieldValReg: " + ex.Message); }

                            //append default records to tblCustomFieldDefReg
                            strSQL = "SELECT tblCustomRegFlagDesc.* " +
                                    "FROM tblCustomRegFlagDesc";

                            cmdCT.CommandText = strSQL;
                            cmdCT.Parameters.Clear();

                            using (OleDbDataReader drCust = cmdCT.ExecuteReader())
                            {
                                if (drCust.Read())
                                {
                                    bool blnUse = false;
                                    string strVal = "";

                                    using (OleDbConnection conAppendDB = new OleDbConnection(clsAppSettings.GetAppSettings().strCTConn))
                                    {
                                        conAppendDB.Open();

                                        using (OleDbCommand cmdAppend = new OleDbCommand())
                                        {
                                            cmdAppend.Connection = conAppendDB;

                                            int intSort = 0;

                                            for (int intI = 1; intI <= 30; intI++)
                                            {
                                                //flag
                                                try { blnUse = Convert.ToBoolean(drCust["blnFlag" + intI.ToString()]); }
                                                catch { blnUse = false; }

                                                try { strVal = Convert.ToString(drCust["strFlag" + intI.ToString() + "Desc"]); }
                                                catch { strVal = ""; }

                                                if (blnUse && strVal != "")
                                                {
                                                    intSort++;

                                                    strSQL = "INSERT INTO tblCustomFieldDefReg " +
                                                            "( blnUseLocal, " +
                                                                "lngProgramID, lngSortOrder, " +
                                                                "decCharge, "+
                                                                "strLocalCaption, strFieldType ) " +
                                                            "VALUES " +
                                                            "( 1, " +
                                                                "0, " + intSort.ToString() + ", " +
                                                                "@decCharge, "+
                                                                "@strLocalCaption, 'FLAG')";

                                                    cmdAppend.CommandText = strSQL;
                                                    cmdAppend.Parameters.Clear();

                                                    cmdAppend.Parameters.AddWithValue("@decCharge",cstWebRegFlags[intI - 1].decCharge);
                                                    cmdAppend.Parameters.AddWithValue("@strLocalCaption", strVal);

                                                    try { cmdAppend.ExecuteNonQuery(); }
                                                    catch (Exception ex) { MessageBox.Show("Error converting data into tblCustomFieldDefReg: " + ex.Message); }

                                                    //add records to val table
                                                    strSQL = "INSERT INTO tblCustomFieldValReg " +
                                                            "( lngRegistrationID, " +
                                                                "strLocalCaption, strValue ) " +
                                                            "SELECT tblRegistrations.lngRegistrationID, " +
                                                                "@strLocalCaption AS strLocalCaption, tblRegistrations.blnCustomRegFlag" + intI.ToString() + " " +
                                                            "FROM tblRegistrations";

                                                    cmdAppend.Parameters.Clear();
                                                    cmdAppend.CommandText = strSQL;

                                                    cmdAppend.Parameters.AddWithValue("@strLocalCaption", strVal);

                                                    try { cmdAppend.ExecuteNonQuery(); }
                                                    catch (Exception ex) { MessageBox.Show("There was an error adding custom reg field values: " + ex.Message); }
                                                }

                                                //field
                                                try { blnUse = Convert.ToBoolean(drCust["blnField" + intI.ToString()]); }
                                                catch { blnUse = false; }

                                                try { strVal = Convert.ToString(drCust["strField" + intI.ToString() + "Desc"]); }
                                                catch { strVal = ""; }

                                                if (blnUse && strVal != "")
                                                {
                                                    intSort++;

                                                    strSQL = "INSERT INTO tblCustomFieldDefReg " +
                                                            "( blnUseLocal, " +
                                                                "lngProgramID, lngSortOrder, " +
                                                                "strLocalCaption, strFieldType ) " +
                                                            "VALUES " +
                                                            "( 1, " +
                                                                "0, " + intSort.ToString() + ", " +
                                                                "@strLocalCaption, 'FIELD')";

                                                    cmdAppend.CommandText = strSQL;
                                                    cmdAppend.Parameters.Clear();

                                                    cmdAppend.Parameters.AddWithValue("@strLocalCaption", strVal);

                                                    try { cmdAppend.ExecuteNonQuery(); }
                                                    catch (Exception ex) { MessageBox.Show("Error converting data into tblCustomFieldDefReg: " + ex.Message); }

                                                    //add records to val table
                                                    strSQL = "INSERT INTO tblCustomFieldValReg " +
                                                            "( lngRegistrationID, " +
                                                                "strLocalCaption, strValue ) " +
                                                            "SELECT tblRegistrations.lngRecordID, " +
                                                                "@strLocalCaption AS strLocalCaption, tblRegistrations.strRegField" + intI.ToString() + " " +
                                                            "FROM tblRegistrations " +
                                                            "WHERE strRegField" + intI.ToString() + "<>''";

                                                    cmdAppend.Parameters.Clear();
                                                    cmdAppend.CommandText = strSQL;

                                                    cmdAppend.Parameters.AddWithValue("@strLocalCaption", strVal);

                                                    try { cmdAppend.ExecuteNonQuery(); }
                                                    catch { }
                                                }
                                            }
                                        }

                                        conAppendDB.Close();
                                    }
                                }

                                drCust.Close();
                            }
                        }

                        //field options
                        blnAddFields = false;

                        strSQL = "SELECT lngCustomFieldDefIROptionID " +
                                "FROM tblCustomFieldDefIROptions";

                        cmdCT.CommandText = strSQL;
                        cmdCT.Parameters.Clear();

                        try { cmdCT.ExecuteNonQuery(); }
                        catch { blnAddFields = true; }

                        if (blnAddFields)
                        {
                            strSQL = "CREATE TABLE tblCustomFieldDefIROptions " +
                                    "( lngCustomFieldDefIROptionID COUNTER CONSTRAINT lngCustomFieldDefIROptionID_PK PRIMARY KEY, " +
                                        "intSortOrder LONG, " +
                                        "strLocalCaption TEXT(255), " +
                                        "strValue  TEXT(255) )";

                            cmdCT.CommandText = strSQL;
                            cmdCT.Parameters.Clear();

                            try { cmdCT.ExecuteNonQuery(); }
                            catch { }

                            strSQL = "CREATE TABLE tblCustomFieldDefRegOptions " +
                                    "( lngCustomFieldDefRegOptionID COUNTER CONSTRAINT lngCustomFieldDefRegOptionID_PK PRIMARY KEY, " +
                                        "intSortOrder LONG, " +
                                        "strLocalCaption TEXT(255), " +
                                        "strValue  TEXT(255) )";

                            cmdCT.CommandText = strSQL;
                            cmdCT.Parameters.Clear();

                            try { cmdCT.ExecuteNonQuery(); }
                            catch { }
                        }

                        //clean up old defs for custom fields
                        strSQL = "DELETE tblCustomFieldDefIR.* " +
                                "FROM tblCustomFieldDefIR " +
                                "WHERE tblCustomFieldDefIR.lngProgramID<>0";

                        cmdCT.CommandText = strSQL;
                        cmdCT.Parameters.Clear();

                        try { cmdCT.ExecuteNonQuery(); }
                        catch { }

                        //clean up old defs for reg custom fields
                        strSQL = "DELETE tblCustomFieldDefReg.* " +
                                "FROM tblCustomFieldDefReg " +
                                "WHERE tblCustomFieldDefReg.lngProgramID<>0";

                        cmdCT.CommandText = strSQL;
                        cmdCT.Parameters.Clear();

                        try { cmdCT.ExecuteNonQuery(); }
                        catch { }

                        blnAddFields = false;

                        strSQL = "SELECT lngGWTransID " +
                                "FROM tblMerchantGatewayTrans";

                        cmdCT.CommandText = strSQL;
                        cmdCT.Parameters.Clear();

                        try { cmdCT.ExecuteNonQuery(); }
                        catch { blnAddFields = true; }

                        if (blnAddFields)
                        {
                            strSQL = "CREATE TABLE tblMerchantGatewayTrans " +
                                    "(lngGWTransID LONG CONSTRAINT pkGWTransID PRIMARY KEY, " +
                                    "dteTransDate DATETIME, " +
                                    "decAmount CURRENCY, " +
                                    "strFName TEXT(50), " +
                                    "strLName TEXT(100), " +
                                    "strAddress TEXT(100), " +
                                    "strCity TEXT(100), " +
                                    "strState TEXT(50), " +
                                    "strZip TEXT(50), " +
                                    "strCountry TEXT(100), " +
                                    "strEmail TEXT(100), " +
                                    "strCTID TEXT(100), " +
                                    "strStatus TEXT(100), " +
                                    "strLastFour TEXT(4), " +
                                    "strMerchantRef TEXT(50), " +
                                    "strSource TEXT(10))";

                            cmdCT.CommandText = strSQL;
                            cmdCT.Parameters.Clear();

                            cmdCT.ExecuteNonQuery();
                        }

                        subManageTlkpTransType(cmdCT);

                        if (!fcnAddField(cmdCT, "tblWebGift", "blnPledgeReminders", "YESNO", "", ref strErr)) MessageBox.Show("There was an error adding tblWebGift.blnPledgeReminders:\n" + strErr);
                        if (!fcnAddField(cmdCT, "tblWebGift", "blnPledgeAutopay", "YESNO", "", ref strErr)) MessageBox.Show("There was an error adding tblWebGift.blnPledgeAutopay:\n" + strErr);
                        if (!fcnAddField(cmdCT, "tblWebGift", "intPledgeFreq", "INTEGER", "", ref strErr)) MessageBox.Show("There was an error adding tblWebGift.intPledgeFreq:\n" + strErr);
                        if (!fcnAddField(cmdCT, "tblWebGift", "intPledgeTerm", "INTEGER", "", ref strErr)) MessageBox.Show("There was an error adding tblWebGift.intPledgeTerm:\n" + strErr);

                        if (!fcnAddField(cmdCT, "tlkpWeekDesc", "lngWeekWebID", "LONG", "", ref strErr)) MessageBox.Show("There was an error adding tlkpWeekDesc.lngWeekWebID:\n" + strErr);

                        if (!fcnAddField(cmdCT, "tlkpAgeGroup", "lngAgeGroupWebID", "LONG", "", ref strErr)) MessageBox.Show("There was an error adding tlkpAgeGroup.lngAgeGroupWebID:\n" + strErr);

                        if (!fcnAddField(cmdCT, "tlkpGradeGroup", "lngGradeGroupWebID", "LONG", "", ref strErr)) MessageBox.Show("There was an error adding tlkpGradeGroup.lngGradeGroupWebID:\n" + strErr);

                        if (!fcnAddField(cmdCT, "tlkpCampName", "lngCampWebID", "LONG", "", ref strErr)) MessageBox.Show("There was an error adding tlkpCampName.lngCampWebID:\n" + strErr);
                        if (!fcnAddField(cmdCT, "tlkpCampName", "blnExcludeFromGeneral", "YESNO", "0", ref strErr)) MessageBox.Show("There was an error adding tlkpCampName.blnExcludeFromGeneral:\n" + strErr);

                        if (!fcnAddField(cmdCT, "tlkpHousingName", "lngHousingWebID", "LONG", "", ref strErr)) MessageBox.Show("There was an error adding tlkpHousingName.lngHousingWebID:\n" + strErr);

                        if (!fcnAddField(cmdCT, "tblGoogleCalOptions", "strBlockCal", "TEXT(100)", "", ref strErr)) MessageBox.Show("There was an error adding tblGoogleCalOptions.strBlockCal:\n" + strErr);
                        if (!fcnAddField(cmdCT, "tblGoogleCalOptions", "strGGCal", "TEXT(100)", "", ref strErr)) MessageBox.Show("There was an error adding tblGoogleCalOptions.strGGCal:\n" + strErr);
                        if (!fcnAddField(cmdCT, "tblGoogleCalOptions", "strCCCal", "TEXT(100)", "", ref strErr)) MessageBox.Show("There was an error adding tblGoogleCalOptions.strCCCal:\n" + strErr);

                        if (!fcnAddField(cmdCT, "tlkpTransType", "lngTransTypeWebID", "LONG", "", ref strErr)) MessageBox.Show("There was an error adding tlkpTransType.lngTransTypeWebID:\n" + strErr);

                        if (!fcnAddField(cmdCT, "tblMOR", "lngMORWebID", "LONG", "", ref strErr)) MessageBox.Show("There was an error adding tblMOR.lngMORWebID:\n" + strErr);

                        if (!fcnAddField(cmdCT, "tblnkMORIR", "lngMORIRLinkWebID", "LONG", "", ref strErr)) MessageBox.Show("There was an error adding tblnkMORIR.lngMORIRLinkWebID:\n" + strErr);

                        if (!fcnAddField(cmdCT, "tblWebIndRegistrations", "blnProcessed", "YESNO", "0", ref strErr)) MessageBox.Show("There was an error adding tblCampDefaults.strGooglePW:\n" + strErr);
                        if (!fcnAddField(cmdCT, "tblWebIndRegistrations", "lngRegSourceID", "LONG", "", ref strErr)) MessageBox.Show("There was an error adding tblCampDefaults.lngRegSourceID:\n" + strErr);
                        if (!fcnAddField(cmdCT, "tblWebIndRegistrations", "strPmtType", "TEXT(10)", "", ref strErr)) MessageBox.Show("There was an error adding tblWebIndRegistrations.strPmtType:\n" + strErr);
                        if (!fcnAddField(cmdCT, "tblWebIndRegistrations", "strXCAlias", "TEXT(25)", "", ref strErr)) MessageBox.Show("There was an error adding tblWebIndRegistrations.strXCAlias:\n" + strErr);
                        if (!fcnAddField(cmdCT, "tblWebIndRegistrations", "strRoutingNumber", "TEXT(35)", "", ref strErr)) MessageBox.Show("There was an error adding tblWebIndRegistrations.strRoutingNumber:\n" + strErr);
                        if (!fcnAddField(cmdCT, "tblWebIndRegistrations", "strAcctNumber", "TEXT(35)", "", ref strErr)) MessageBox.Show("There was an error adding tblWebIndRegistrations.strAcctNumber:\n" + strErr);
                        if (!fcnAddField(cmdCT, "tblWebIndRegistrations", "strPNRef", "TEXT(50)", "", ref strErr)) MessageBox.Show("There was an error adding tblWebIndRegistrations.strPNRef:\n" + strErr);
                        if (!fcnAddField(cmdCT, "tblWebIndRegistrations", "strXCAuthCode", "TEXT(50)", "", ref strErr)) MessageBox.Show("There was an error adding tblWebIndRegistrations.strXCAuthCode:\n" + strErr);
                        for (int intI = 1; intI <= 10; intI++)
                            if (!fcnAddField(cmdCT, "tblWebIndRegistrations", "blnDiscount" + intI.ToString(), "YESNO", "0", ref strErr)) MessageBox.Show("There was an error adding tblWebIndRegistrations.blnDiscount" + intI.ToString() + ":\n" + strErr);
                        if (!fcnAddField(cmdCT, "tblWebIndRegistrations", "strEPSTransID", "TEXT(50)", "", ref strErr)) MessageBox.Show("There was an error adding tblWebIndRegistrations.strEPSTransID:\n" + strErr);
                        if (!fcnAddField(cmdCT, "tblWebIndRegistrations", "strEPSApprovalNumber", "TEXT(50)", "", ref strErr)) MessageBox.Show("There was an error adding tblWebIndRegistrations.strEPSApprovalNumber:\n" + strErr);
                        if (!fcnAddField(cmdCT, "tblWebIndRegistrations", "strEPSValidationCode", "TEXT(50)", "", ref strErr)) MessageBox.Show("There was an error adding tblWebIndRegistrations.strEPSValidationCode:\n" + strErr);
                        if (!fcnAddField(cmdCT, "tblWebIndRegistrations", "strEPSPmtAcctID", "TEXT(50)", "", ref strErr)) MessageBox.Show("There was an error adding tblWebIndRegistrations.strEPSPmtAcctID:\n" + strErr);
                        if (!fcnAddField(cmdCT, "tblWebIndRegistrations", "strOrgCode", "TEXT(50)", "", ref strErr)) MessageBox.Show("There was an error adding tblWebIndRegistrations.strOrgCode:\n" + strErr);

                        if (!fcnAddField(cmdCT, "tblCampDefaults", "strGoogleUName", "TEXT(50)", "", ref strErr)) MessageBox.Show("There was an error adding tblCampDefaults.strGoogleUName:\n" + strErr);
                        if (!fcnAddField(cmdCT, "tblCampDefaults", "strGooglePW", "TEXT(50)", "", ref strErr)) MessageBox.Show("There was an error adding tblCampDefaults.strGooglePW:\n" + strErr);
                        if (!fcnAddField(cmdCT, "tblCampDefaults", "strXChargeWebID", "TEXT(30)", "", ref strErr)) MessageBox.Show("There was an error adding tblCampDefaults.strXChargeWebID:\n" + strErr);
                        if (!fcnAddField(cmdCT, "tblCampDefaults", "strXChargeAuthKey", "TEXT(50)", "", ref strErr)) MessageBox.Show("There was an error adding tblCampDefaults.strXChargeAuthKey:\n" + strErr);
                        if (!fcnAddField(cmdCT, "tblCampDefaults", "strXChargeTerminalID", "TEXT(30)", "", ref strErr)) MessageBox.Show("There was an error adding tblCampDefaults.strXChargeTerminalID:\n" + strErr);
                        if (!fcnAddField(cmdCT, "tblCampDefaults", "strCashLinqCQUser", "TEXT(30)", "", ref strErr)) MessageBox.Show("There was an error adding tblCampDefaults.strXChargeTerminalID:\n" + strErr);
                        if (!fcnAddField(cmdCT, "tblCampDefaults", "strCashLinqCQPW", "TEXT(30)", "", ref strErr)) MessageBox.Show("There was an error adding tblCampDefaults.strXChargeTerminalID:\n" + strErr);
                        if (!fcnAddField(cmdCT, "tblCampDefaults", "strCashLinqCQMerchantID", "TEXT(30)", "", ref strErr)) MessageBox.Show("There was an error adding tblCampDefaults.strXChargeTerminalID:\n" + strErr);
                        if (!fcnAddField(cmdCT, "tblCampDefaults", "lngDefCustRegFlagTransType", "LONG", "", ref strErr)) MessageBox.Show("There was an error adding tblCampDefaults.lngDefCustRegFlagTransType:\n" + strErr);
                        if (!fcnAddField(cmdCT, "tblCampDefaults", "lngDXCampaignID", "LONG", "", ref strErr)) MessageBox.Show("There was an error adding tblCampDefaults.lngDXCampaignID:\n" + strErr);
                        if (!fcnAddField(cmdCT, "tblCampDefaults", "lngDXCategoryID", "LONG", "", ref strErr)) MessageBox.Show("There was an error adding tblCampDefaults.lngDXCategoryID:\n" + strErr);
                        if (!fcnAddField(cmdCT, "tblCampDefaults", "strEPSAcceptorID", "TEXT(20)", "", ref strErr)) MessageBox.Show("There was an error adding tblCampDefaults.strEPSAcceptorID:\n" + strErr);
                        if (!fcnAddField(cmdCT, "tblCampDefaults", "strEPSAccountID", "TEXT(20)", "", ref strErr)) MessageBox.Show("There was an error adding tblCampDefaults.strEPSAccountID:\n" + strErr);
                        if (!fcnAddField(cmdCT, "tblCampDefaults", "strEPSAccountToken", "TEXT(100)", "", ref strErr)) MessageBox.Show("There was an error adding tblCampDefaults.strEPSAccountToken:\n" + strErr);
                        if (!fcnAddField(cmdCT, "tblCampDefaults", "strEPSTerminalID", "TEXT(10)", "", ref strErr)) MessageBox.Show("There was an error adding tblCampDefaults.strEPSTerminalID:\n" + strErr);

                        if (!fcnAddField(cmdCT, "tblWebIndRegistrations", "lngRegHoldID", "LONG", "", ref strErr)) MessageBox.Show("There was an error adding tblWebIndRegistrations.lngRegHoldID:\n" + strErr);
                        if (!fcnAddField(cmdCT, "tblWebIndRegistrations", "strCardNumber", "TEXT(50)", "", ref strErr)) MessageBox.Show("There was an error adding tblWebIndRegistrations.strCardNumber:\n" + strErr);

                        if (!fcnAddField(cmdCT, "tblWebRecords", "mmoSpecialNeeds", "MEMO", "", ref strErr)) MessageBox.Show("There was an error adding tblWebRecords.mmoSpecialNeeds:\n" + strErr);
                        if (!fcnAddField(cmdCT, "tblWebRecords", "dteBirthdate", "DATETIME", "", ref strErr)) MessageBox.Show("There was an error adding tblWebRecords.dteBirthdate:\n" + strErr);
                        if (!fcnAddField(cmdCT, "tblWebRecords", "strMotherName", "TEXT(50)", "", ref strErr)) MessageBox.Show("There was an error adding tblWebRecords.strMother:\n" + strErr);
                        if (!fcnAddField(cmdCT, "tblWebRecords", "strFatherName", "TEXT(50)", "", ref strErr)) MessageBox.Show("There was an error adding tblWebRecords.strFather:\n" + strErr);
                        if (!fcnAddField(cmdCT, "tblWebRecords", "strPassword", "TEXT(50)", "", ref strErr)) MessageBox.Show("There was an error adding tblWebRecords.strPassword:\n" + strErr);

                        if (!fcnAddField(cmdCT, "tblRegistrations", "strReferredBy", "TEXT(50)", "", ref strErr)) MessageBox.Show("There was an error adding tblRegistrations.strReferredBy:\n" + strErr);
                        if (!fcnAddField(cmdCT, "tblRegistrations", "lngRegistrationWebID", "LONG", "", ref strErr)) MessageBox.Show("There was an error adding tblRegistrations.lngRegistrationWebID:\n" + strErr);
                        if (!fcnAddField(cmdCT, "tblRegistrations", "dteProcessed", "DATETIME", "NOW()", ref strErr)) MessageBox.Show("There was an error adding tblRegistrations.dteProcessed:\n" + strErr);
                        if (!fcnAddField(cmdCT, "tblRegistrations", "strOrgCode", "TEXT(50)", "", ref strErr)) MessageBox.Show("There was an error adding tblRegistrations.strOrgCode:\n" + strErr);

                        if (!fcnAddField(cmdCT, "tblRegHold", "lngRegHoldWebID", "LONG", "", ref strErr)) MessageBox.Show("There was an error adding tblRegHold.lngRegHoldWebID:\n" + strErr);
                        if (!fcnAddField(cmdCT, "tblRegHold", "curRegCharge", "CURRENCY", "0", ref strErr)) MessageBox.Show("There was an error adding tblRegHold.curRegCharge:\n" + strErr);
                        if (!fcnAddField(cmdCT, "tblRegHold", "blnSharedCostPercent", "YESNO", "0", ref strErr)) MessageBox.Show("There was an error adding tblRegHold.blnSharedCostPercent:\n" + strErr);

                        if (!fcnAddField(cmdCT, "tblWebGift", "strXCAlias", "TEXT(50)", "", ref strErr)) MessageBox.Show("There was an error adding tblWebGift.strXCAlias:\n" + strErr);
                        if (!fcnAddField(cmdCT, "tblWebGift", "strXCTransID", "TEXT(50)", "", ref strErr)) MessageBox.Show("There was an error adding tblWebGift.strXCTransID:\n" + strErr);
                        if (!fcnAddField(cmdCT, "tblWebGift", "strXCEFTAuthCode", "TEXT(50)", "", ref strErr)) MessageBox.Show("There was an error adding tblWebGift.strXCEFTAuthCode:\n" + strErr);
                        if (!fcnAddField(cmdCT, "tblWebGift", "strXCEFTRefID", "TEXT(50)", "", ref strErr)) MessageBox.Show("There was an error adding tblWebGift.strXCEFTRefID:\n" + strErr);
                        if (!fcnAddField(cmdCT, "tblWebGift", "strEPSTransID", "TEXT(50)", "", ref strErr)) MessageBox.Show("There was an error adding tblWebGift.strEPSTransID:\n" + strErr);
                        if (!fcnAddField(cmdCT, "tblWebGift", "strEPSApprovalNumber", "TEXT(50)", "", ref strErr)) MessageBox.Show("There was an error adding tblWebGift.strEPSApprovalNumber:\n" + strErr);
                        if (!fcnAddField(cmdCT, "tblWebGift", "strEPSValidationCode", "TEXT(50)", "", ref strErr)) MessageBox.Show("There was an error adding tblWebGift.strEPSValidationCode:\n" + strErr);
                        if (!fcnAddField(cmdCT, "tblWebGift", "strEPSPmtAcctID", "TEXT(50)", "", ref strErr)) MessageBox.Show("There was an error adding tblWebGift.strEPSPmtAcctID:\n" + strErr);

                        if (!fcnAddField(cmdCT, "tblWebTransactions", "strEPSTransID", "TEXT(50)", "", ref strErr)) MessageBox.Show("There was an error adding tblWebTransactions.strEPSTransID:\n" + strErr);
                        if (!fcnAddField(cmdCT, "tblWebTransactions", "strEPSApprovalNumber", "TEXT(50)", "", ref strErr)) MessageBox.Show("There was an error adding tblWebTransactions.strEPSApprovalNumber:\n" + strErr);
                        if (!fcnAddField(cmdCT, "tblWebTransactions", "strEPSValidationCode", "TEXT(50)", "", ref strErr)) MessageBox.Show("There was an error adding tblWebTransactions.strEPSValidationCode:\n" + strErr);
                        if (!fcnAddField(cmdCT, "tblWebTransactions", "strEPSPmtAcctID", "TEXT(50)", "", ref strErr)) MessageBox.Show("There was an error adding tblWebTransactions.strEPSPmtAcctID:\n" + strErr);

                        if (!fcnAddField(cmdCT, "tblGGCCRegistrations", "strEPSTransID", "TEXT(50)", "", ref strErr)) MessageBox.Show("There was an error adding tblGGCCRegistrations.strEPSTransID:\n" + strErr);
                        if (!fcnAddField(cmdCT, "tblGGCCRegistrations", "strEPSApprovalNumber", "TEXT(50)", "", ref strErr)) MessageBox.Show("There was an error adding tblGGCCRegistrations.strEPSApprovalNumber:\n" + strErr);
                        if (!fcnAddField(cmdCT, "tblGGCCRegistrations", "strEPSValidationCode", "TEXT(50)", "", ref strErr)) MessageBox.Show("There was an error adding tblGGCCRegistrations.strEPSValidationCode:\n" + strErr);
                        if (!fcnAddField(cmdCT, "tblGGCCRegistrations", "strEPSPmtAcctID", "TEXT(50)", "", ref strErr)) MessageBox.Show("There was an error adding tblGGCCRegistrations.strEPSPmtAcctID:\n" + strErr);

                        if (!fcnAddField(cmdCT, "tblDonorExpress", "strEPSTransID", "TEXT(50)", "", ref strErr)) MessageBox.Show("There was an error adding tblDonorExpress.strEPSTransID:\n" + strErr);
                        if (!fcnAddField(cmdCT, "tblDonorExpress", "strEPSApprovalNumber", "TEXT(50)", "", ref strErr)) MessageBox.Show("There was an error adding tblDonorExpress.strEPSApprovalNumber:\n" + strErr);
                        if (!fcnAddField(cmdCT, "tblDonorExpress", "strEPSValidationCode", "TEXT(50)", "", ref strErr)) MessageBox.Show("There was an error adding tblDonorExpress.strEPSValidationCode:\n" + strErr);
                        if (!fcnAddField(cmdCT, "tblDonorExpress", "strEPSPmtAcctID", "TEXT(50)", "", ref strErr)) MessageBox.Show("There was an error adding tblDonorExpress.strEPSPmtAcctID:\n" + strErr);

                        if (!fcnAddField(cmdCT, "tblBillingInfo", "strXCAlias", "TEXT(50)", "", ref strErr)) MessageBox.Show("There was an error adding tblBillingInfo.strXCAlias:\n" + strErr);
                        if (!fcnAddField(cmdCT, "tblBillingInfo", "strXCTransID", "TEXT(50)", "", ref strErr)) MessageBox.Show("There was an error adding tblBillingInfo.strXCTransID:\n" + strErr);
                        if (!fcnAddField(cmdCT, "tblBillingInfo", "strXCEFTAuthCode", "TEXT(50)", "", ref strErr)) MessageBox.Show("There was an error adding tblBillingInfo.strXCEFTAuthCode:\n" + strErr);
                        if (!fcnAddField(cmdCT, "tblBillingInfo", "strXCEFTRefID", "TEXT(50)", "", ref strErr)) MessageBox.Show("There was an error adding tblBillingInfo.strXCEFTRefID:\n" + strErr);
                        if (!fcnAddField(cmdCT, "tblBillingInfo", "strEPSPmtAcctID", "TEXT(50)", "", ref strErr)) MessageBox.Show("There was an error adding tblBillingInfo.strEPSPmtAcctID:\n" + strErr);

                        if (!fcnAddField(cmdCT, "tblPledge", "blnPledgeAutopay", "YESNO", "0", ref strErr)) MessageBox.Show("There was an error adding tblPledge.blnPledgeAutopay:\n" + strErr);
                        if (!fcnAddField(cmdCT, "tblPledge", "blnMemorial", "YESNO", "0", ref strErr)) MessageBox.Show("There was an error adding tblPledge.blnMemorial:\n" + strErr);
                        if (!fcnAddField(cmdCT, "tblPledge", "blnInHonorOf", "YESNO", "0", ref strErr)) MessageBox.Show("There was an error adding tblPledge.blnInHonorOf:\n" + strErr);
                        if (!fcnAddField(cmdCT, "tblPledge", "lngPaymentTypeID", "LONG", "", ref strErr)) MessageBox.Show("There was an error adding tblPledge.lngPaymentTypeID:\n" + strErr);
                        if (!fcnAddField(cmdCT, "tblPledge", "lngBillStateID", "LONG", "", ref strErr)) MessageBox.Show("There was an error adding tblPledge.lngBillStateID:\n" + strErr);
                        if (!fcnAddField(cmdCT, "tblPledge", "strXCAlias", "TEXT(50)", "", ref strErr)) MessageBox.Show("There was an error adding tblPledge.strXCAlias:\n" + strErr);
                        if (!fcnAddField(cmdCT, "tblPledge", "strXCTransID", "TEXT(50)", "", ref strErr)) MessageBox.Show("There was an error adding tblPledge.strXCTransID:\n" + strErr);
                        if (!fcnAddField(cmdCT, "tblPledge", "strXCEFTAuthCode", "TEXT(50)", "", ref strErr)) MessageBox.Show("There was an error adding tblPledge.strXCEFTAuthCode:\n" + strErr);
                        if (!fcnAddField(cmdCT, "tblPledge", "strXCEFTRefID", "TEXT(50)", "", ref strErr)) MessageBox.Show("There was an error adding tblPledge.strXCEFTRefID:\n" + strErr);
                        if (!fcnAddField(cmdCT, "tblPledge", "strPNRef", "TEXT(50)", "", ref strErr)) MessageBox.Show("There was an error adding tblPledge.strPNRef:\n" + strErr);
                        if (!fcnAddField(cmdCT, "tblPledge", "strMemorialName", "TEXT(50)", "", ref strErr)) MessageBox.Show("There was an error adding tblPledge.strMemorialName:\n" + strErr);
                        if (!fcnAddField(cmdCT, "tblPledge", "strInHonorOf", "TEXT(50)", "", ref strErr)) MessageBox.Show("There was an error adding tblPledge.strInHonorOf:\n" + strErr);
                        if (!fcnAddField(cmdCT, "tblPledge", "strAcctNum", "TEXT(50)", "", ref strErr)) MessageBox.Show("There was an error adding tblPledge.strAcctNum:\n" + strErr);
                        if (!fcnAddField(cmdCT, "tblPledge", "strBankName", "TEXT(50)", "", ref strErr)) MessageBox.Show("There was an error adding tblPledge.strBankName:\n" + strErr);
                        if (!fcnAddField(cmdCT, "tblPledge", "strBillAddress", "TEXT(50)", "", ref strErr)) MessageBox.Show("There was an error adding tblPledge.strBillAddress:\n" + strErr);
                        if (!fcnAddField(cmdCT, "tblPledge", "strBillCity", "TEXT(50)", "", ref strErr)) MessageBox.Show("There was an error adding tblPledge.strBillCity:\n" + strErr);
                        if (!fcnAddField(cmdCT, "tblPledge", "strBillName", "TEXT(50)", "", ref strErr)) MessageBox.Show("There was an error adding tblPledge.strBillName:\n" + strErr);
                        if (!fcnAddField(cmdCT, "tblPledge", "strBillPhone", "TEXT(50)", "", ref strErr)) MessageBox.Show("There was an error adding tblPledge.strBillPhone:\n" + strErr);
                        if (!fcnAddField(cmdCT, "tblPledge", "strBillZip", "TEXT(50)", "", ref strErr)) MessageBox.Show("There was an error adding tblPledge.strBillZip:\n" + strErr);
                        if (!fcnAddField(cmdCT, "tblPledge", "strCCExpDate", "TEXT(50)", "", ref strErr)) MessageBox.Show("There was an error adding tblPledge.strCCExpDate:\n" + strErr);
                        if (!fcnAddField(cmdCT, "tblPledge", "strCCNumber", "TEXT(50)", "", ref strErr)) MessageBox.Show("There was an error adding tblPledge.strCCNumber:\n" + strErr);
                        if (!fcnAddField(cmdCT, "tblPledge", "strCCValCode", "TEXT(50)", "", ref strErr)) MessageBox.Show("There was an error adding tblPledge.strCCValCode:\n" + strErr);
                        if (!fcnAddField(cmdCT, "tblPledge", "strRoutingNum", "TEXT(50)", "", ref strErr)) MessageBox.Show("There was an error adding tblPledge.strRoutingNum:\n" + strErr);
                        if (!fcnAddField(cmdCT, "tblPledge", "strEPSTransID", "TEXT(50)", "", ref strErr)) MessageBox.Show("There was an error adding tblPledge.strEPSTransID:\n" + strErr);
                        if (!fcnAddField(cmdCT, "tblPledge", "strEPSApprovalNumber", "TEXT(50)", "", ref strErr)) MessageBox.Show("There was an error adding tblPledge.strEPSApprovalNumber:\n" + strErr);
                        if (!fcnAddField(cmdCT, "tblPledge", "strEPSValidationCode", "TEXT(50)", "", ref strErr)) MessageBox.Show("There was an error adding tblPledge.strEPSValidationCode:\n" + strErr);
                        if (!fcnAddField(cmdCT, "tblPledge", "strEPSPmtAcctID", "TEXT(50)", "", ref strErr)) MessageBox.Show("There was an error adding tblPledge.strEPSPmtAcctID:\n" + strErr);

                        if (!fcnAddField(cmdCT, "tblBlock", "curMinDep", "CURRENCY", "0", ref strErr)) MessageBox.Show("There was an error adding tblBlock.curMinDep:\n" + strErr);
                        if (!fcnAddField(cmdCT, "tblBlock", "lngBlockWebID", "LONG", "", ref strErr)) MessageBox.Show("There was an error adding tblBlock.lngBlockWebID:\n" + strErr);

                        if (!fcnAddField(cmdCT, "tblTransactions", "strXCAlias", "TEXT(50)", "", ref strErr)) MessageBox.Show("There was an error adding tblTransactions.strXCAlias:\n" + strErr);
                        if (!fcnAddField(cmdCT, "tblTransactions", "strXCTransID", "TEXT(50)", "", ref strErr)) MessageBox.Show("There was an error adding tblTransactions.strXCTransID:\n" + strErr);
                        if (!fcnAddField(cmdCT, "tblTransactions", "strXCAuthCode", "TEXT(50)", "", ref strErr)) MessageBox.Show("There was an error adding tblTransactions.strXCAuthCode:\n" + strErr);
                        if (!fcnAddField(cmdCT, "tblTransactions", "lngTransactionWebID", "LONG", "", ref strErr)) MessageBox.Show("There was an error adding tblTransactions.lngTransactionWebID:\n" + strErr);
                        if (!fcnAddField(cmdCT, "tblTransactions", "lngTransBalanceWebID", "LONG", "", ref strErr)) MessageBox.Show("There was an error adding tblTransactions.lngTransBalanceWebID:\n" + strErr);
                        if (!fcnAddField(cmdCT, "tblTransactions", "strEPSTransID", "TEXT(50)", "", ref strErr)) MessageBox.Show("There was an error adding tblTransactions.strEPSTransID:\n" + strErr);
                        if (!fcnAddField(cmdCT, "tblTransactions", "strEPSApprovalNumber", "TEXT(50)", "", ref strErr)) MessageBox.Show("There was an error adding tblTransactions.strEPSApprovalNumber:\n" + strErr);
                        if (!fcnAddField(cmdCT, "tblTransactions", "strEPSValidationCode", "TEXT(50)", "", ref strErr)) MessageBox.Show("There was an error adding tblTransactions.strEPSValidationCode:\n" + strErr);
                        if (!fcnAddField(cmdCT, "tblTransactions", "strEPSPmtAcctID", "TEXT(50)", "", ref strErr)) MessageBox.Show("There was an error adding tblTransactions.strEPSPmtAcctID:\n" + strErr);

                        if (!fcnAddField(cmdCT, "tblGift", "strXCAlias", "TEXT(50)", "", ref strErr)) MessageBox.Show("There was an error adding tblGift.strXCAlias:\n" + strErr);
                        if (!fcnAddField(cmdCT, "tblGift", "strXCTransID", "TEXT(50)", "", ref strErr)) MessageBox.Show("There was an error adding tblGift.strXCTransID:\n" + strErr);
                        if (!fcnAddField(cmdCT, "tblGift", "strPNRef", "TEXT(50)", "", ref strErr)) MessageBox.Show("There was an error adding tblGift.strPNRef:\n" + strErr);
                        if (!fcnAddField(cmdCT, "tblGift", "strXCAuthCode", "TEXT(50)", "", ref strErr)) MessageBox.Show("There was an error adding tblGift.strXCAuthCode:\n" + strErr);
                        if (!fcnAddField(cmdCT, "tblGift", "strEPSTransID", "TEXT(50)", "", ref strErr)) MessageBox.Show("There was an error adding tblGift.strEPSTransID:\n" + strErr);
                        if (!fcnAddField(cmdCT, "tblGift", "strEPSApprovalNumber", "TEXT(50)", "", ref strErr)) MessageBox.Show("There was an error adding tblGift.strEPSApprovalNumber:\n" + strErr);
                        if (!fcnAddField(cmdCT, "tblGift", "strEPSValidationCode", "TEXT(50)", "", ref strErr)) MessageBox.Show("There was an error adding tblGift.strEPSValidationCode:\n" + strErr);
                        if (!fcnAddField(cmdCT, "tblGift", "strEPSPmtAcctID", "TEXT(50)", "", ref strErr)) MessageBox.Show("There was an error adding tblGift.strEPSPmtAcctID:\n" + strErr);

                        if (!fcnAddField(cmdCT, "tblSecurity", "lngUserWebID", "LONG", "", ref strErr)) MessageBox.Show("There was an error adding tblSecurity.lngUserWebID:\n" + strErr);

                        if (!fcnAddField(cmdCT, "tblWebGGCCRegistrations", "strXCAlias", "TEXT(25)", "", ref strErr)) MessageBox.Show("There was an error adding tblWebGGCCRegistrations.strXCAlias:\n" + strErr);
                        if (!fcnAddField(cmdCT, "tblWebGGCCRegistrations", "strXCTransID", "TEXT(50)", "", ref strErr)) MessageBox.Show("There was an error adding tblWebGGCCRegistrations.strXCTransID:\n" + strErr);
                        if (!fcnAddField(cmdCT, "tblWebGGCCRegistrations", "strEPSTransID", "TEXT(50)", "", ref strErr)) MessageBox.Show("There was an error adding tblWebGGCCRegistrations.strEPSTransID:\n" + strErr);
                        if (!fcnAddField(cmdCT, "tblWebGGCCRegistrations", "strEPSApprovalNumber", "TEXT(50)", "", ref strErr)) MessageBox.Show("There was an error adding tblWebGGCCRegistrations.strEPSApprovalNumber:\n" + strErr);
                        if (!fcnAddField(cmdCT, "tblWebGGCCRegistrations", "strEPSValidationCode", "TEXT(50)", "", ref strErr)) MessageBox.Show("There was an error adding tblWebGGCCRegistrations.strEPSValidationCode:\n" + strErr);
                        if (!fcnAddField(cmdCT, "tblWebGGCCRegistrations", "strEPSPmtAcctID", "TEXT(50)", "", ref strErr)) MessageBox.Show("There was an error adding tblWebGGCCRegistrations.strEPSPmtAcctID:\n" + strErr);

                        if (!fcnAddField(cmdCT, "tblCustomFieldsGiftDef", "intSortOrder", "INTEGER", "", ref strErr)) MessageBox.Show("There was an error adding tblCustomFieldsGiftDef.intSortOrder:\n" + strErr);

                        if (!fcnAddField(cmdCT, "tblRecords", "blnToSync", "YESNO", "", ref strErr)) MessageBox.Show("There was an error adding tblRecords.blnToSync:\n" + strErr);
                        if (!fcnAddField(cmdCT, "tblRecords", "strPassword", "TEXT(50)", "", ref strErr)) MessageBox.Show("There was an error adding tblRecords.strPassword:\n" + strErr);
                    }

                    conCT.Close();
                }
            }
            catch (Exception ex)
            {
                clsErr.subLogErr("subStructureUpdateMDB", ex);
            }
        }