当前位置: 首页>>代码示例>>C#>>正文


C# ADODB.Recordset.AddNew方法代码示例

本文整理汇总了C#中ADODB.Recordset.AddNew方法的典型用法代码示例。如果您正苦于以下问题:C# ADODB.Recordset.AddNew方法的具体用法?C# ADODB.Recordset.AddNew怎么用?C# ADODB.Recordset.AddNew使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ADODB.Recordset的用法示例。


在下文中一共展示了ADODB.Recordset.AddNew方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: loadItem

        public void loadItem(ref int id)
        {
            System.Windows.Forms.TextBox oText = null;
            System.Windows.Forms.CheckBox oCheck = null;
             // ERROR: Not supported in C#: OnErrorStatement

            if (id) {
                gID = id;
                adoPrimaryRS = modRecordSet.getRS(ref "select * from Deposit WHERE DepositID = " + id);
            } else {
                gID = 0;
                adoPrimaryRS = modRecordSet.getRS(ref "select * from Deposit");
                adoPrimaryRS.AddNew();
                this.Text = this.Text + " [New record]";

                mbAddNewFlag = true;
            }
            setup();
            foreach (TextBox oText_loopVariable in txtFields) {
                oText = oText_loopVariable;
                oText.DataBindings.Add(adoPrimaryRS);
                oText.MaxLength = adoPrimaryRS.Fields(oText.DataBindings).DefinedSize;
            }
            foreach (TextBox oText_loopVariable in txtHide) {
                oText = oText_loopVariable;
                oText.DataBindings.Add(adoPrimaryRS);
            }
            foreach (TextBox oText_loopVariable in txtInteger) {
                oText = oText_loopVariable;
                oText.DataBindings.Add(adoPrimaryRS);
                oText.Leave += txtInteger_Leave;
                //txtInteger_Leave(txtInteger.Item((oText.Index)), New System.EventArgs())
            }
            foreach (TextBox oText_loopVariable in txtFloat) {
                oText = oText_loopVariable;
                oText.DataBindings.Add(adoPrimaryRS);

                if (string.IsNullOrEmpty(oText.Text))
                    oText.Text = "0";
                oText.Text = Convert.ToString(Convert.ToDouble(oText.Text) * 100);
                oText.Leave += txtFloat_Leave;
                //txtFloat_Leave(txtFloat.Item((oText.Index)), New System.EventArgs())
            }
            //    For Each oText In Me.txtFloatNegative
            //        Set oText.DataBindings.Add(adoPrimaryRS)
            //        If oText.Text = "" Then oText.Text = "0"
            //        oText.Text = oText.Text * 100
            //        txtFloatNegative_LostFocus oText.Index
            //    Next
            //Bind the check boxes to the data provider
            foreach (CheckBox oCheck_loopVariable in chkFields) {
                oCheck = oCheck_loopVariable;
                oCheck.DataBindings.Add(adoPrimaryRS);
            }
            buildDataControls();
            mbDataChanged = false;

            loadLanguage();
            ShowDialog();
        }
开发者ID:nodoid,项目名称:PointOfSale,代码行数:60,代码来源:frmDeposit.cs

示例2: loadItem

        public void loadItem(ref int id)
        {
            System.Windows.Forms.TextBox oText = null;
            System.Windows.Forms.CheckBox oCheck = null;
            if (id) {
                adoPrimaryRS = modRecordSet.getRS(ref "select * from PrintGroup WHERE PrintGroupID = " + id);
            } else {
                adoPrimaryRS = modRecordSet.getRS(ref "select * from PrintGroup");
                adoPrimaryRS.AddNew();
                this.Text = this.Text + " [New record]";
                mbAddNewFlag = true;
            }
            setup();
            foreach (TextBox oText_loopVariable in this.txtFields) {
                oText = oText_loopVariable;
                oText.DataBindings.Add(adoPrimaryRS);
                oText.MaxLength = adoPrimaryRS.Fields(oText.DataBindings).DefinedSize;
            }
            foreach (TextBox oText_loopVariable in this.txtInteger) {
                oText = oText_loopVariable;
                oText.DataBindings.Add(adoPrimaryRS);
                oText.Leave += txtInteger_Leave;
            }
            buildDataControls();
            mbDataChanged = false;

            loadLanguage();
            ShowDialog();
        }
开发者ID:nodoid,项目名称:PointOfSale,代码行数:29,代码来源:frmPrintGroup.cs

示例3: loadItem

        public void loadItem(ref int id)
        {
            System.Windows.Forms.TextBox oText = null;
            System.Windows.Forms.CheckBox oCheck = null;
             // ERROR: Not supported in C#: OnErrorStatement

            if (id) {
                adoPrimaryRS = modRecordSet.getRS(ref "select * from StockGroup WHERE StockGRoupID = " + id);
            } else {
                adoPrimaryRS = modRecordSet.getRS(ref "select * from StockGroup");
                adoPrimaryRS.AddNew();
                this.Text = this.Text + " [New record]";
                mbAddNewFlag = true;
            }
            setup();
            BindingSource bind = new BindingSource();
            foreach (TextBox oText_loopVariable in this.txtFields) {
                oText = oText_loopVariable;
                bind.DataSource = adoPrimaryRS;
                oText.DataBindings.Add(bind.DataSource);
                oText.MaxLength = adoPrimaryRS.Fields(oText.DataBindings).DefinedSize;
            }

            foreach (CheckBox oCheck_loopVariable in this.chkFields) {
                oCheck = oCheck_loopVariable;
                oCheck.DataBindings.Add(bind.DataSource);
            }

            buildDataControls();
            mbDataChanged = false;

            loadLanguage();
            ShowDialog();
        }
开发者ID:nodoid,项目名称:PointOfSale,代码行数:34,代码来源:frmStockGroup.cs

示例4: loadItem

        public void loadItem(ref int id)
        {
            System.Windows.Forms.TextBox oText = null;
            System.Windows.Forms.CheckBox oCheck = null;
             // ERROR: Not supported in C#: OnErrorStatement

            if (id) {
                pRid = id;
                adoPrimaryRS = modRecordSet.getRS(ref "select PricingGroupID,PricingGroup_Name,PricingGroup_RemoveCents,PricingGroup_RoundAfter,PricingGroup_RoundDown,PricingGroup_Unit1,PricingGroup_Case1,PricingGroup_Unit2,PricingGroup_Case2,PricingGroup_Unit3,PricingGroup_Case3,PricingGroup_Unit4,PricingGroup_Case4,PricingGroup_Unit5,PricingGroup_Case5,PricingGroup_Unit6,PricingGroup_Case6,PricingGroup_Unit7,PricingGroup_Case7,PricingGroup_Unit8,PricingGroup_Case8,PricingGroup_Disabled from PricingGroup WHERE PricingGroupID = " + id);
            } else {
                adoPrimaryRS = modRecordSet.getRS(ref "select * from PricingGroup");
                adoPrimaryRS.AddNew();
                this.Text = this.Text + " [New record]";
                mbAddNewFlag = true;
            }
            setup();
            foreach (TextBox oText_loopVariable in this.txtFields) {
                oText = oText_loopVariable;
                oText.DataBindings.Add(adoPrimaryRS);
                oText.MaxLength = adoPrimaryRS.Fields(oText.DataBindings).DefinedSize;
            }
            foreach (TextBox oText_loopVariable in this.txtInteger) {
                oText = oText_loopVariable;
                oText.DataBindings.Add(adoPrimaryRS);
                oText.Leave += txtInteger_Leave;
            }
            foreach (TextBox oText_loopVariable in this.txtFloat) {
                oText = oText_loopVariable;
                oText.DataBindings.Add(adoPrimaryRS);
                if (string.IsNullOrEmpty(oText.Text))
                    oText.Text = "0";
                oText.Text = Convert.ToString(Convert.ToDouble(oText.Text) * 100);
                oText.Leave += txtFloat_Leave;
            }
            foreach (TextBox oText_loopVariable in this.txtFloatNegative) {
                oText = oText_loopVariable;
                oText.DataBindings.Add(adoPrimaryRS);
                if (string.IsNullOrEmpty(oText.Text))
                    oText.Text = "0";
                oText.Text = Convert.ToString(Convert.ToDouble(oText.Text) * 100);
                oText.Leave += txtFloatNegative_Leave;
            }

            if (Convert.ToInt16(adoPrimaryRS.Fields("PricingGroup_Disabled").Value)) {
                this.chkPricing.CheckState = System.Windows.Forms.CheckState.Checked;
                this.chkPricing.Tag = 1;
            } else {
                this.chkPricing.Tag = 0;
            }

            buildDataControls();
            mbDataChanged = false;

            loadLanguage();
            ShowDialog();
        }
开发者ID:nodoid,项目名称:PointOfSale,代码行数:56,代码来源:frmPricingGroup.cs

示例5: loadItem

        public void loadItem(ref int id)
        {
            System.Windows.Forms.TextBox oText = null;
            System.Windows.Forms.CheckBox oCheck = null;
             // ERROR: Not supported in C#: OnErrorStatement

            if (id) {
                adoPrimaryRS = modRecordSet.getRS(ref "select * from Pricelist WHERE PricelistID = " + id);
            } else {
                adoPrimaryRS = modRecordSet.getRS(ref "select * from Pricelist");
                adoPrimaryRS.AddNew();
                this.Text = this.Text + " [New record]";
                mbAddNewFlag = true;
            }
            setup();
            foreach (TextBox oText_loopVariable in txtFields) {
                oText = oText_loopVariable;
                oText.DataBindings.Add(adoPrimaryRS);
                oText.MaxLength = adoPrimaryRS.Fields(oText.DataBindings).DefinedSize;
            }
            //    For Each oText In Me.txtInteger
            //        Set oText.DataBindings.Add(adoPrimaryRS)
            //        txtInteger_LostFocus oText.Index
            //    Next
            //    For Each oText In Me.txtFloat
            //        Set oText.DataBindings.Add(adoPrimaryRS)
            //        If oText.Text = "" Then oText.Text = "0"
            //        oText.Text = oText.Text * 100
            //        txtFloat_LostFocus oText.Index
            //    Next
            //    For Each oText In Me.txtFloatNegative
            //        Set oText.DataBindings.Add(adoPrimaryRS)
            //        If oText.Text = "" Then oText.Text = "0"
            //        oText.Text = oText.Text * 100
            //        txtFloatNegative_LostFocus oText.Index
            //    Next
            //Bind the check boxes to the data provider
            foreach (CheckBox oCheck_loopVariable in chkFields) {
                oCheck = oCheck_loopVariable;
                oCheck.DataBindings.Add(adoPrimaryRS);
            }
            buildDataControls();
            mbDataChanged = false;
            if (this.cmbDelivery.SelectedIndex == -1) {
                chkChannel.CheckState = System.Windows.Forms.CheckState.Unchecked;
                cmbDelivery.Enabled = false;
            } else {
                chkChannel.CheckState = System.Windows.Forms.CheckState.Checked;
                cmbDelivery.Enabled = true;
            }

            loadLanguage();
            ShowDialog();
        }
开发者ID:nodoid,项目名称:PointOfSale,代码行数:54,代码来源:frmPriceList.cs

示例6: loadItem

        public void loadItem(ref int id)
        {
            System.Windows.Forms.TextBox oText = null;
            System.Windows.Forms.CheckBox oCheck = null;
            if (id) {
                adoPrimaryRS = modRecordSet.getRS(ref "select * from VAT WHERE VATID = " + id);
            } else {
                adoPrimaryRS = modRecordSet.getRS(ref "select * from VAT");
                adoPrimaryRS.AddNew();
                this.Text = this.Text + " [New record]";
                mbAddNewFlag = true;
            }
            setup();
            oText = _txtFields_0;
            oText.DataBindings.Add(adoPrimaryRS);
            oText.MaxLength = adoPrimaryRS.Fields(oText.DataBindings).DefinedSize;
            //Next oText
            //    For Each oText In Me.txtInteger
            //        Set oText.DataBindings.Add(adoPrimaryRS)
            //        txtInteger_LostFocus oText.Index
            //    Next
            oText = _txtFloat_0;
            oText.DataBindings.Add(adoPrimaryRS);
            if (string.IsNullOrEmpty(oText.Text))
                oText.Text = "0";
            oText.Text = Convert.ToString(Convert.ToDouble(oText.Text) * 100);
            oText.Leave += txtFloat_Leave;
            //txtFloat_Leave(_txtFloat_0.Item(0, New System.EventArgs()))
            //Next oText
            //    For Each oText In Me.txtFloatNegative
            //        Set oText.DataBindings.Add(adoPrimaryRS)
            //        If oText.Text = "" Then oText.Text = "0"
            //        oText.Text = oText.Text * 100
            //        txtFloatNegative_LostFocus oText.Index
            //    Next
            //Bind the check boxes to the data provider
            //        For Each oCheck In Me.chkFields
            //            Set oCheck.DataBindings.Add(adoPrimaryRS)
            //        Next
            buildDataControls();
            mbDataChanged = false;

            loadLanguage();
            ShowDialog();
        }
开发者ID:nodoid,项目名称:PointOfSale,代码行数:45,代码来源:frmVAT.cs

示例7: loadItem

        public void loadItem(ref int id)
        {
            System.Windows.Forms.TextBox oText = null;
            DateTimePicker oDate = null;
            System.Windows.Forms.CheckBox oCheck = null;

            mbAddNewFlagID = false;

             // ERROR: Not supported in C#: OnErrorStatement

            if (id) {
                p_Prom = id;
                adoPrimaryRS = modRecordSet.getRS(ref "select GRVPromotion.* from GRVPromotion WHERE PromotionID = " + id);
            } else {
                adoPrimaryRS = modRecordSet.getRS(ref "select * from GRVPromotion");
                adoPrimaryRS.AddNew();
                this.Text = this.Text + " [New record]";
                mbAddNewFlag = true;
                mbAddNewFlagID = true;
            }
            setup();
            foreach (TextBox oText_loopVariable in txtFields) {
                oText = oText_loopVariable;
                oText.DataBindings.Add(adoPrimaryRS);
                oText.MaxLength = adoPrimaryRS.Fields(oText.DataBindings).DefinedSize;
            }

            foreach (DateTimePicker oDate_loopVariable in DTFields) {
                oDate = oDate_loopVariable;
                oDate.DataBindings.Add(adoPrimaryRS);
            }

            //adoPrimaryRS("Promotion_SpeTime")
            //Bind the check boxes to the data provider
            foreach (CheckBox oCheck_loopVariable in chkFields) {
                oCheck = oCheck_loopVariable;
                oCheck.DataBindings.Add(adoPrimaryRS);
            }
            buildDataControls();
            mbDataChanged = false;
            loadItems();

            loadLanguage();
            ShowDialog();
        }
开发者ID:nodoid,项目名称:PointOfSale,代码行数:45,代码来源:frmGRVPromotionold.cs

示例8: loadItem

        public void loadItem(ref int id)
        {
            System.Windows.Forms.TextBox oText = null;
            System.Windows.Forms.CheckBox oCheck = null;
             // ERROR: Not supported in C#: OnErrorStatement

            if (id) {
                k_posNew = false;
                k_posID = id;
                //Get Warehouse ID...
                adoPrimaryRS = modRecordSet.getRS(ref "select * from Warehouse WHERE WarehouseID = " + id);
            } else {
                k_posNew = true;
                adoPrimaryRS = modRecordSet.getRS(ref "select * from Warehouse");
                adoPrimaryRS.AddNew();
                this.Text = this.Text + " [New record]";
                _txtInteger_0.Enabled = true;
                mbAddNewFlag = true;
            }

            setup();
            foreach (TextBox oText_loopVariable in this.txtFields) {
                oText = oText_loopVariable;
                oText.DataBindings.Add(adoPrimaryRS);
                oText.MaxLength = adoPrimaryRS.Fields(oText.DataBindings).DefinedSize;
            }
            foreach (TextBox oText_loopVariable in this.txtInteger) {
                oText = oText_loopVariable;
                oText.DataBindings.Add(adoPrimaryRS);
                oText.Leave += txtInteger_Leave;
                //txtInteger_Leave(txtInteger.Item((oText.Index)), New System.EventArgs())
            }

            bolLoad = true;
            if (id) {

            }
            bolLoad = false;

            mbDataChanged = false;

            loadLanguage();
            ShowDialog();
        }
开发者ID:nodoid,项目名称:PointOfSale,代码行数:44,代码来源:frmWH.cs

示例9: loadItem

        public void loadItem(ref int id, ref short section)
        {
            System.Windows.Forms.TextBox oText = null;
            System.Windows.Forms.CheckBox oCheck = null;
             // ERROR: Not supported in C#: OnErrorStatement

            this.lblSettl.Visible = true;
            this.txtSettlement.Visible = true;

            if (id) {
                adoPrimaryRS = modRecordSet.getRS(ref "select SupplierID,Supplier_Name,Supplier_PostalAddress,Supplier_PhysicalAddress,Supplier_Telephone,Supplier_Facimile,Supplier_RepresentativeName,Supplier_RepresentativeNumber,Supplier_ShippingCode,Supplier_OrderAttentionLine,Supplier_Ullage,Supplier_discountCOD,Supplier_discount15days,Supplier_discount30days,Supplier_discount60days,Supplier_discount90days,Supplier_discount120days,Supplier_discountSmartCard,Supplier_discountDefault,Supplier_Current,Supplier_30Days,Supplier_60Days,Supplier_90Days,Supplier_120Days from Supplier WHERE SupplierID = " + id);
            } else {
                adoPrimaryRS = modRecordSet.getRS(ref "select * from Supplier");
                adoPrimaryRS.AddNew();
                this.Text = this.Text + " [New record]";
                mbAddNewFlag = true;
            }
            gSection = section;
            switch (gSection) {
                case sec_Payment:
                    this.Text = "Account Payment";
                    break;
                case sec_Debit:
                    this.lblSettl.Visible = false;
                    this.txtSettlement.Visible = false;
                    this._lblLabels_11.Text = "Debit Journal";
                    this.Text = "Debit Journal-Increase amount owing";
                    break;
                case sec_Credit:
                    this.lblSettl.Visible = false;
                    this.txtSettlement.Visible = false;
                    this._lblLabels_11.Text = "Credit Journal";
                    this.Text = "Credit Journal-Decrease amount owing";
                    break;
                default:
                    this.Close();
                    return;

                    break;
            }
            _lbl_2.Text = "&2. Transaction (" + this.Text + ")";
            this.cmbPeriod.SelectedIndex = 0;
            //    If adoPrimaryRS.BOF Or adoPrimaryRS.EOF Then
            //    Else
            foreach (TextBox oText_loopVariable in this.txtFields) {
                oText = oText_loopVariable;
                oText.DataBindings.Add(adoPrimaryRS);
                oText.MaxLength = adoPrimaryRS.Fields(oText.DataBindings).DefinedSize;
            }
            //        For Each oText In Me.txtInteger
            //            Set oText.DataBindings.Add(adoPrimaryRS)
            //            txtInteger_LostFocus oText.Index
            //        Next
            foreach (TextBox oText_loopVariable in this.txtFloat) {
                oText = oText_loopVariable;
                oText.DataBindings.Add(adoPrimaryRS);
                if (string.IsNullOrEmpty(oText.Text))
                    oText.Text = "0";
                oText.Text = Convert.ToString(Convert.ToDouble(oText.Text) * 100);
                oText.Leave += txtFloat_Leave;
            }
            //        For Each oText In Me.txtFloatNegative
            //            Set oText.DataBindings.Add(adoPrimaryRS)
            //            If oText.Text = "" Then oText.Text = "0"
            //            oText.Text = oText.Text * 100
            //            txtFloatNegative_LostFocus oText.Index
            //        Next
            //Bind the check boxes to the data provider
            //        For Each oCheck In Me.chkFields
            //            Set oCheck.DataBindings.Add(adoPrimaryRS)
            //        Next
            buildDataControls();
            mbDataChanged = false;

            loadLanguage();
            ShowDialog();
            //    End If
        }
开发者ID:nodoid,项目名称:PointOfSale,代码行数:78,代码来源:frmSupplierTransaction.cs

示例10: loadItem

        public void loadItem(ref int id)
        {
            int x = 0;
            string lCode = null;
            string leCode = null;
            string lPassword = null;

            System.Windows.Forms.TextBox oText = null;
            System.Windows.Forms.CheckBox oCheck = null;
             // ERROR: Not supported in C#: OnErrorStatement

            if (id) {
                k_posNew = false;
                k_posID = id;
                //Get POS ID...
                adoPrimaryRS = modRecordSet.getRS(ref "select * from POS WHERE POSID = " + id);

                //new serialization check
                lPassword = Strings.LTrim(Strings.Replace(My.MyProject.Forms.frmMenu.lblCompany.Text, "'", ""));
                lPassword = Strings.RTrim(Strings.Replace(lPassword, " ", ""));
                lPassword = Strings.Trim(Strings.Replace(lPassword, ".", ""));
                lPassword = Strings.LCase(lPassword);
                leCode = "";
                lCode = "";
                for (x = 0; x <= Strings.Len(lPassword); x++) {
                    lCode = Strings.Mid(lPassword, x, 1);
                    lCode = Convert.ToString(Strings.Asc(lCode));
                    if (Convert.ToDouble(lCode) > 96 & Convert.ToDouble(lCode) < 123) {
                        leCode = leCode + Strings.Mid(lPassword, x, 1);
                    }
                }
                lPassword = leCode;
                lCode = Convert.ToString(adoPrimaryRS.Fields("POS_CID").Value * 135792468);
                leCode = Encrypt(lCode, lPassword);
                for (x = 1; x <= Strings.Len(leCode); x++) {
                    if (Strings.Asc(Strings.Mid(leCode, x, 1)) < 33) {
                        leCode = Strings.Left(leCode, x - 1) + Strings.Chr(33) + Strings.Mid(leCode, x + 1);
                    }
                }
                if (Strings.Split(adoPrimaryRS.Fields("POS_Code").Value, Strings.Chr(255))[0] != leCode) {
                    lblLic[1].Visible = true;
                    lblLic[0].Visible = true;
                }
                //new serialization check
            } else {
                k_posNew = true;
                adoPrimaryRS = modRecordSet.getRS(ref "select * from POS");
                adoPrimaryRS.AddNew();
                this.Text = this.Text + " [New record]";
                mbAddNewFlag = true;
            }

            setup();

            foreach (TextBox oText_loopVariable in txtFields) {
                oText = oText_loopVariable;
                oText.DataBindings.Add(adoPrimaryRS);
                oText.MaxLength = adoPrimaryRS.Fields(oText.DataBindings).DefinedSize;
            }
            if (k_posNew == true)
                _txtFields_10.Text = basCryptoProcs.strCDKey;
            foreach (TextBox oText_loopVariable in txtInteger) {
                oText = oText_loopVariable;
                oText.DataBindings.Add(adoPrimaryRS);
                oText.Leave += txtInteger_Leave;
                //txtInteger_Leave(txtInteger.Item((oText.Index)), New System.EventArgs())
            }
            foreach (TextBox oText_loopVariable in txtFloat) {
                oText = oText_loopVariable;
                oText.DataBindings.Add(adoPrimaryRS);
                if (string.IsNullOrEmpty(oText.Text))
                    oText.Text = "0";
                oText.Text = Convert.ToString(Convert.ToDouble(oText.Text) * 100);
                oText.Leave += txtFloat_Leave;
                //txtFloat_Leave(txtFloat.Item((oText.Index)), New System.EventArgs())
            }

            bolLoad = true;
            if (id) {
                if (adoPrimaryRS.Fields("POS_KitchenMonitor").Value == true) {
                    this.chkKitchenMonitors.CheckState = System.Windows.Forms.CheckState.Checked;
                    this.chkKitchenMonitors.Tag = 1;
                } else {
                    this.chkKitchenMonitors.CheckState = System.Windows.Forms.CheckState.Unchecked;
                    this.chkKitchenMonitors.Tag = 0;
                }
            }
            bolLoad = false;

            //Bind the check boxes to the data provider
            foreach (CheckBox oCheck_loopVariable in chkFields) {
                oCheck = oCheck_loopVariable;
                oCheck.DataBindings.Add(adoPrimaryRS);
            }
            buildDataControls();

             // ERROR: Not supported in C#: OnErrorStatement

            if (id) {
            } else {
//.........这里部分代码省略.........
开发者ID:nodoid,项目名称:PointOfSale,代码行数:101,代码来源:frmPOS.cs

示例11: CopyTable

        public void CopyTable(ADOX.Table tblAccess)
        {
            ADODB.Recordset recMaster = new ADODB.Recordset();
            ADODB.Recordset recLoop = new ADODB.Recordset();
            int intLoop = 0;

            string strInfile = "";
            string strSQL = "SELECT ";
            string strRecord;
            string strLoadFilePath = strSourceDbPath.Replace("\\", "\\\\");
            string strFileName = strTempPath + tblAccess.Name + ".txt";

            StreamWriter sw = new StreamWriter(strFileName, false);
            //create the infile
                strInfile += "LOAD DATA LOCAL INFILE '" + strFileName + "' INTO TABLE " + strMySQLDBName + "." + tblAccess.Name + " ";
                strInfile += "FIELDS TERMINATED BY ',' ";
                strInfile += "ESCAPED BY '\\\\' ";
                strInfile += "LINES TERMINATED BY 0x0d0a ";
                strInfile += "(";

                //loop through fields to enumerate them for the infile and build a select statement
                for (intLoop = 0; intLoop < tblAccess.Columns.Count; intLoop++)
                {
                    strInfile += MySQLName((tblAccess.Columns[intLoop].Name));
                    switch (tblAccess.Columns[intLoop].Type)
                    {
                        case ADOX.DataTypeEnum.adDate: //convert to MySQL datetime format
                            strSQL += "FORMAT([" + tblAccess.Columns[intLoop].Name + "],  'YYYY-MM-DD HH:MM:SS') as " + tblAccess.Columns[intLoop].Name;
                            break;
                        default:
                            strSQL += "[" + tblAccess.Columns[intLoop].Name + "]";
                            break;
                    }
                    if (intLoop < tblAccess.Columns.Count - 1)
                    {
                        strSQL += ",";
                        strInfile += ", ";
                    }
                }
                strInfile += ");";
                strSQL += " FROM [" + tblAccess.Name + "]";

                //open the "Master" recordset
                recMaster.CursorLocation = ADODB.CursorLocationEnum.adUseClient;
                recMaster.Open(strSQL, conJCMS_db, ADODB.CursorTypeEnum.adOpenStatic, ADODB.LockTypeEnum.adLockOptimistic, 0);

                //create the "Loop" recordset, this is a clone of the master, with the exception
                //that the definedsize for text fields is lengthened.  This is because the added
                //escape characters could potentially exceed the field length in the master recordset
                recLoop.CursorLocation = ADODB.CursorLocationEnum.adUseClient;
                ADODB.Fields fdsLoop = recLoop.Fields;
                ADODB.Fields fdsMaster = recMaster.Fields;
                foreach (ADODB.Field fldIn in fdsMaster)
                {
                    if (fldIn.Type.ToString().IndexOf("Char") > 0)
                    {
                        fdsLoop.Append(fldIn.Name,
                            fldIn.Type,
                            fldIn.DefinedSize + 30,
                            ADODB.FieldAttributeEnum.adFldIsNullable,
                            null);
                    }
                    else
                    {
                        fdsLoop.Append(fldIn.Name,
                        fldIn.Type,
                        fldIn.DefinedSize,
                        ADODB.FieldAttributeEnum.adFldIsNullable,
                        null);
                    }
                }
                recLoop.Open(System.Reflection.Missing.Value, System.Reflection.Missing.Value, ADODB.CursorTypeEnum.adOpenStatic, ADODB.LockTypeEnum.adLockOptimistic, 0);

                recLoop.AddNew(System.Reflection.Missing.Value, System.Reflection.Missing.Value);

                while (!recMaster.EOF)
                {
                    for (int columnIndex = 0; columnIndex < recMaster.Fields.Count; columnIndex++)
                    {
                        recLoop.Fields[columnIndex].Value = recMaster.Fields[columnIndex].Value;
                        if (recLoop.Fields[columnIndex].Value.ToString().Length > 0)
                        {
                            if ((recLoop.Fields[columnIndex].Value.ToString().IndexOf("\\", 0) + 1) > 0)
                            {
                                recLoop.Fields[columnIndex].Value = recLoop.Fields[columnIndex].Value.ToString().Replace("\\", "\\\\");
                            }
                            if ((recLoop.Fields[columnIndex].Value.ToString().IndexOf(",", 0) + 1) > 0)
                            {
                                recLoop.Fields[columnIndex].Value = recLoop.Fields[columnIndex].Value.ToString().Replace(",", "\\,");
                            }
                            if ((recLoop.Fields[columnIndex].Value.ToString().IndexOf(System.Environment.NewLine, 0) + 1) > 0)
                            {
                                recLoop.Fields[columnIndex].Value = recLoop.Fields[columnIndex].Value.ToString().Replace(System.Environment.NewLine, " ");
                            }
                        }
                    }
                    strRecord = recLoop.GetString(ADODB.StringFormatEnum.adClipString, 1, ",", System.Environment.NewLine, "\\N");
                    recLoop.MovePrevious();
                    sw.Write(strRecord);
                    recMaster.MoveNext();
//.........这里部分代码省略.........
开发者ID:BethSundberg,项目名称:JCMS-root,代码行数:101,代码来源:frmProgress.cs

示例12: loadItem

        public void loadItem(ref int id)
        {
            System.Windows.Forms.TextBox oText = null;
            System.Windows.Forms.CheckBox oCheck = null;
             // ERROR: Not supported in C#: OnErrorStatement

            if (id) {
                adoPrimaryRS = modRecordSet.getRS(ref "select * from Channel WHERE ChannelID = " + id);
                //        If IsNull(adoPrimaryRS("Channel_PriceToChannel1")) Then
                //            cmbChannelPrice.ListIndex = 0
                //        Else
                switch (adoPrimaryRS.Fields("Channel_PriceToChannel1").Value) {
                    case -1:
                        cmbChannelPrice.SelectedIndex = 1;
                        break;
                    case 1:
                        cmbChannelPrice.SelectedIndex = 2;
                        break;
                    default:
                        cmbChannelPrice.SelectedIndex = 0;
                        break;
                }
                //        End If
            } else {
                adoPrimaryRS = modRecordSet.getRS(ref "select * from POS");
                adoPrimaryRS.AddNew();
                this.Text = this.Text + " [New record]";
                mbAddNewFlag = true;
            }

            setup();
            foreach (TextBox oText_loopVariable in txtFields) {
                oText = oText_loopVariable;
                oText.DataBindings.Add(adoPrimaryRS);
                oText.MaxLength = adoPrimaryRS.Fields(oText.DataBindings).DefinedSize;
            }
            this.optType[Convert.ToInt16(_txtFields_0.Text)].Checked = true;
            if (id == 1) {
                _optType_0.Enabled = false;
                _optType_1.Enabled = false;
            }
            //    For Each oText In Me.txtInteger
            //        Set oText.DataBindings.Add(adoPrimaryRS)
            //        txtInteger_LostFocus oText.Index
            //    Next
            //    For Each oText In Me.txtFloat
            //        Set oText.DataBindings.Add(adoPrimaryRS)
            //        If oText.Text = "" Then oText.Text = "0"
            //        oText.Text = oText.Text * 100
            //        txtFloat_LostFocus oText.Index
            //    Next
            //    For Each oText In Me.txtFloatNegative
            //        Set oText.DataBindings.Add(adoPrimaryRS)
            //        If oText.Text = "" Then oText.Text = "0"
            //        oText.Text = oText.Text * 100
            //        txtFloatNegative_LostFocus oText.Index
            //    Next
            //Bind the check boxes to the data provider
            foreach (CheckBox oCheck_loopVariable in chkFields) {
                oCheck = oCheck_loopVariable;
                oCheck.DataBindings.Add(adoPrimaryRS);
            }
            buildDataControls();
            mbDataChanged = false;

            loadLanguage();
            ShowDialog();
        }
开发者ID:nodoid,项目名称:PointOfSale,代码行数:68,代码来源:frmChannel.cs

示例13: loadItem

        public void loadItem(ref int id)
        {
            ADODB.Recordset rs = default(ADODB.Recordset);
            int lID = 0;
            System.Windows.Forms.TextBox oText = null;
            System.Windows.Forms.CheckBox oCheck = null;
             // ERROR: Not supported in C#: OnErrorStatement

            if (id) {
                adoPrimaryRS = modRecordSet.getRS(ref "SELECT PriceSet.PriceSetID, PriceSet.PriceSet_Name, PriceSet.PriceSet_StockItemID, PriceSet.PriceSet_Disabled From PriceSet WHERE (((PriceSet.PriceSetID)=" + id + "));");
            } else {
                adoPrimaryRS = modRecordSet.getRS(ref "select * from [PriceSet]");
                adoPrimaryRS.AddNew();
                this.Text = this.Text + "[New Record]";
                mbAddNewFlag = true;
            }
            setup();

            foreach (TextBox oText_loopVariable in txtFields) {
                oText = oText_loopVariable;
                oText.DataBindings.Add(adoPrimaryRS);
                oText.MaxLength = adoPrimaryRS.Fields(oText.DataBindings).DefinedSize;
            }

            //Bind the check boxes to the data provider
            foreach (CheckBox oCheck_loopVariable in chkFields) {
                oCheck = oCheck_loopVariable;
                lID = adoPrimaryRS.Fields("PriceSet_StockItemID").Value;
                if (lID != 0) {
                    rs = modRecordSet.getRS(ref "SELECT StockItem.StockItem_Name FROM StockItem WHERE (StockItemID = " + lID + ")");
                    if (rs.BOF | rs.EOF) {
                        this.lblStockItem.Text = "No Stock Item Selected ...";
                        this.lblStockItem.Tag = 0;
                    } else {
                        this.lblStockItem.Text = rs("StockItem_Name");
                        this.lblStockItem.Tag = lID;
                    }

                }
                oCheck.DataBindings.Add(adoPrimaryRS);
            }
            if (_chkFields_0.CheckState == 2)
                _chkFields_0.CheckState = System.Windows.Forms.CheckState.Unchecked;
            buildDataControls();
            mbDataChanged = false;
            setup();

            loadLanguage();
            ShowDialog();
        }
开发者ID:nodoid,项目名称:PointOfSale,代码行数:50,代码来源:frmPriceSet.cs

示例14: printTransactionA4

        private void printTransactionA4(ref transaction lTransaction)
        {
            string typeQuote = null;
            string typeAccountPayment = null;
            string typeConsignment = null;
            string typeConsignmentReturn = null;
            string typeAccountSaleCOD = null;
            string typeAccountSale = null;
            int lRetVal = 0;
            int hkey = 0;
            string vValue = null;
            decimal lnVat = default(decimal);
            string gPath = null;
            ADODB.Recordset rs = default(ADODB.Recordset);
            customer customer_Renamed = null;
            string sql = null;
            ADODB.Recordset rsNew = new ADODB.Recordset();
            //Dim rsNew2                  As New Recordset

            lineItem lineitem_Renamed = null;
            string lString = null;
            CrystalDecisions.CrystalReports.Engine.ReportDocument Report = new CrystalDecisions.CrystalReports.Engine.ReportDocument();
            short lPaymentType = 0;
            string[] lArray = null;
            decimal TCurrency = default(decimal);

            decimal QuoteTotal = default(decimal);

             // ERROR: Not supported in C#: OnErrorStatement

            //Set which invoice is required
            string sPrintGST = null;
            sPrintGST = "";
            QuoteTotal = 0;
            //lRetVal = RegOpenKeyEx(HKEY_LOCAL_MACHINE, "Software\4POS\pos", 0, KEY_QUERY_VALUE, hkey)
            //lRetVal = QueryValueEx(hkey, "printGST", sPrintGST)
            //RegCloseKey (hkey)
            //If sPrintGST = "" Then sPrintGST = "0"

            // If gParameters.A4Exclusive = True Then
            //     Set Report = New cryReceipt1
            // ElseIf sPrintGST = "1" Then
            //     Set Report = New cryReceipt1
            // Else
            Report.Load("cryReceipt.rpt");
            // End If

            //lPaymentType = getPaymentType(lTransaction)

            //If lPaymentType And typeAccountPayment Then
            //    printTransactionPaymentA4 lTransaction
            //    Exit Sub
            //End If
            //Dim lnVat               As Currency
            gPath = "C:\\4POS\\pos\\";
            int lVatAmount = 0;
            int lAmount = 0;

            rsNew.Open(gPath + "data\\item.rs", , ADODB.CursorTypeEnum.adOpenDynamic, ADODB.LockTypeEnum.adLockOptimistic);
            //, adOpenStatic, adLockOptimistic
            lnVat = 0;
            //a = rsNew.RecordCount
            //rsNew.Close

            //rsNew2.source = rsNew.source

            //rsNew("transactionItem_quantity").Type = rsNew("transactionItem_price").Type
            //rsNew("transactionItem_quantity").DefinedSize = rsNew("transactionItem_price").DefinedSize
            //rsNew2("transactionItem_quantity").Attributes = rsNew("transactionItem_price").Attributes
            //rsNew2("transactionItem_quantity").NumericScale = rsNew("transactionItem_price").NumericScale
            //rsNew2("transactionItem_quantity").Precision = rsNew("transactionItem_price").Precision

            foreach (lineItem lineitem_Renamed_loopVariable in lTransaction.lineItems) {
                lineitem_Renamed = lineitem_Renamed_loopVariable;
                rsNew.AddNew();
                if (lineitem_Renamed.revoke) {
                } else {
                    rsNew.Fields("transactionItem_build").Value = lineitem_Renamed.build;
                    rsNew.Fields("transactionItem_code").Value = lineitem_Renamed.code;
                    rsNew.Fields("transactionItem_depositType").Value = lineitem_Renamed.depositType;
                    rsNew.Fields("transactionItem_id").Value = lineitem_Renamed.id;
                    rsNew.Fields("transactionItem_lineNo").Value = lineitem_Renamed.lineNo;
                    rsNew.Fields("transactionItem_name").Value = lineitem_Renamed.name;
                    rsNew.Fields("transactionItem_originalPrice").Value = lineitem_Renamed.originalPrice;
                    rsNew.Fields("transactionItem_price").Value = lineitem_Renamed.price;
                    rsNew.Fields("transactionItem_quantity").Value = lineitem_Renamed.quantity;
                    rsNew.Fields("transactionItem_receiptName").Value = Strings.LTrim(Strings.Mid(lineitem_Renamed.receiptName, Strings.InStr(1, lineitem_Renamed.receiptName, "x") + 1, Strings.Len(lineitem_Renamed.receiptName)));
                    //lineitem.receiptName
                    rsNew.Fields("transactionItem_reversal").Value = lineitem_Renamed.reversal;
                    rsNew.Fields("transactionItem_revoke").Value = lineitem_Renamed.revoke;
                    rsNew.Fields("transactionItem_set").Value = lineitem_Renamed.setBuild;
                    rsNew.Fields("transactionItem_shrink").Value = lineitem_Renamed.shrink;
                    rsNew.Fields("transactionItem_type").Value = lineitem_Renamed.transactionType;
                    rsNew.Fields("transactionItem_vat").Value = lineitem_Renamed.vat;

                    if (lineitem_Renamed.vat > 0)
                        lnVat = lnVat + ((lineitem_Renamed.quantity * lineitem_Renamed.price) - ((lineitem_Renamed.quantity * lineitem_Renamed.price) / (1 + (lineitem_Renamed.vat / 100))));
                    QuoteTotal = QuoteTotal + (lineitem_Renamed.quantity * lineitem_Renamed.price);
                    //If gParameters.A4Exclusive = True Then TCurrency = TCurrency + ((lineitem.quantity * lineitem.price) / (1 + (lineitem.vat) / 100))
                    //TCurrency = 0 'TCurrency + ((lineitem.quantity * lineitem.price) / (1 + (lineitem.vat) / 100))
//.........这里部分代码省略.........
开发者ID:nodoid,项目名称:PointOfSale,代码行数:101,代码来源:frmCustomerAllocPayment.cs

示例15: loadItem

        public void loadItem(ref int id)
        {
            ADODB.Recordset rsP = default(ADODB.Recordset);
            System.Windows.Forms.TextBox oText = null;
            System.Windows.Forms.CheckBox oCheck = null;
             // ERROR: Not supported in C#: OnErrorStatement

            InOper = id;
            inController = false;

            if (id) {
                adoPrimaryRS = modRecordSet.getRS(ref "select PersonID,Person_Title,Person_FirstName,Person_LastName,Person_Position,Person_Cell,Person_Telephone,Person_UserID,Person_Password,Person_QuickAccess,Person_IDNo,Person_Disabled,Person_Drawer from Person WHERE PersonID = " + id);
                rsP = modRecordSet.getRS(ref "SELECT * FROM Person WHERE PersonID = " + id);
                txtComm.Text = Strings.FormatNumber(rsP.Fields("Person_Comm").Value, 2);
                //for duplication access id
                _txtFields_12.Text = rsP.Fields("Person_QuickAccess").Value;

                rsP = modRecordSet.getRS(ref "SELECT Controller_Permission FROM ControllerPermission WHERE Controller_PersonID = " + id);
                if (rsP.RecordCount == 0) {
                    inController = true;
                    modRecordSet.cnnDB.Execute("INSERT INTO ControllerPermission (Controller_PersonID,Controller_Permission) VALUES (" + id + ",0)");
                    this.chkController.CheckState = System.Windows.Forms.CheckState.Unchecked;
                    this.chkController.Tag = 0;
                } else {
                    if (rsP.Fields("Controller_Permission").Value == true) {
                        this.chkController.CheckState = System.Windows.Forms.CheckState.Checked;
                        this.chkController.Tag = 1;
                    } else {
                        this.chkController.CheckState = System.Windows.Forms.CheckState.Unchecked;
                        this.chkController.Tag = 0;
                    }
                }
                _lbl_1.Text = "Employee No. " + id;
            } else {
                adoPrimaryRS = modRecordSet.getRS(ref "select * from Person");
                adoPrimaryRS.AddNew();
                this.Text = this.Text + " [New record]";
                mbAddNewFlag = true;
                _lbl_1.Text = "Employee No. " + " [New record]";
            }

            setup();

            foreach (TextBox oText_loopVariable in this.txtFields) {
                oText = oText_loopVariable;
                oText.DataBindings.Add(adoPrimaryRS);
                oText.MaxLength = adoPrimaryRS.Fields(oText.DataBindings).DefinedSize;
            }

            perIden = id;

             // ERROR: Not supported in C#: OnErrorStatement

            if (id) {
                cmbDraw.SelectedIndex = adoPrimaryRS.Fields("Person_Drawer").Value;
            } else {
                cmbDraw.SelectedIndex = 0;
            }

            foreach (CheckBox oCheck_loopVariable in this.chkFields) {
                oCheck = oCheck_loopVariable;
                oCheck.DataBindings.Add(adoPrimaryRS);
            }

            buildDataControls();
            mbDataChanged = false;

            loadLanguage();
            ShowDialog();
        }
开发者ID:nodoid,项目名称:PointOfSale,代码行数:70,代码来源:frmPerson.cs


注:本文中的ADODB.Recordset.AddNew方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。