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


C# PsqlConnection类代码示例

本文整理汇总了C#中PsqlConnection的典型用法代码示例。如果您正苦于以下问题:C# PsqlConnection类的具体用法?C# PsqlConnection怎么用?C# PsqlConnection使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: button2_Click

        private void button2_Click(object sender, EventArgs e)
        {
            string sConnString = "Server Name=localhost;Database Name=LSYNC;";
            using (PsqlConnection oPastelConn = new PsqlConnection(sConnString))
            {
                oPastelConn.Open();

                Cursor = System.Windows.Forms.Cursors.WaitCursor;
                solPastelSDK clsPastelSDK = new solPastelSDK();

                string[] aLines = new string[2];
                aLines[0] = "0|1|105.28|120|DAY |1|0|0|023PHIREDRILL|DRILL HILTI TE16                        |4|001|     |";
              //              aLines[0] = "0|1|162.28|162.28|DAY |0|0|0|039PHIREGENERA|6KVA GENERATOR HONDA MGS6000            |4|001|     |";
                aLines[1] = "0|1|0.02|0.02|    |0|0|0|1000020        |Rounding                                |6|001|     |";

                string sHeader = "|||ABS001|05/02/2010|IN100159|Y|0|||||||||00001|0||2010/02/05 12:00:00 AM||Blondie||1|||||||||26477506|0";

                string sDataPath = "C:\\Pastel09\\FAIREGLEN";
                string sResult = clsPastelSDK.CreatePastelDocument(sHeader, aLines, 106, sDataPath, Global.iPastelSdkUser, false, oPastelConn, 1);

                MessageBox.Show(sResult);
                //CreatePastelDocument(sHeader, aLines, 106, sDataPath, Global.iPastelSdkUser, Global.bLogCreateDocument);

                //txtSdkResults.Text = sResult;

                Cursor = System.Windows.Forms.Cursors.Default;
            }
        }
开发者ID:anthonied,项目名称:LiquidPastel,代码行数:28,代码来源:Test.cs

示例2: LoadData

        public void LoadData()
        {
            using (PsqlConnection oConn = new PsqlConnection(Connect.sConnStr))
            {
                string sSql = "SELECT * FROM SOLINVENTSS";

                PsqlDataReader rdReader = Connect.getDataCommand(sSql, oConn).ExecuteReader();
                if (rdReader.HasRows)
                {
                    while (rdReader.Read())
                    {
                        int i = dgvSetup.Rows.Add();

                        dgvSetup.Rows[i].Cells["clReceiverRef"].Value = rdReader["sReceiverRef"].ToString().Trim();
                        dgvSetup.Rows[i].Cells["clReceiverAlias"].Value = rdReader["sReceiverAlias"].ToString().Trim();

                        dgvSetup.Rows[i].Cells["clIP"].Value = rdReader["sReceiverIP"].ToString().Trim();
                        dgvSetup.Rows[i].Cells["clSourceRef"].Value = rdReader["sSourceRef"].ToString().Trim();
                        dgvSetup.Rows[i].Cells["clDataPath"].Value = rdReader["sDataPath"].ToString().Trim();
                        dgvSetup.Rows[i].Cells["clSolPMS"].Value = rdReader["sLiquidConn"].ToString().Trim();
                        dgvSetup.Rows[i].Cells["clPastelConn"].Value = rdReader["sPastelConn"].ToString().Trim();

                        dgvSetup.Rows[i].Cells["clSourceStore"].Value = rdReader["sSourceStore"].ToString().Trim();
                        dgvSetup.Rows[i].Cells["clReceiverStore"].Value = rdReader["sReceiverStore"].ToString().Trim();
                    }
                }

                rdReader.Close();
            }
        }
开发者ID:anthonied,项目名称:LiquidPastel,代码行数:30,代码来源:frmSyncInventorySetup.cs

示例3: cmdFinish_Click

        private void cmdFinish_Click(object sender, EventArgs e)
        {
            if (MessageBox.Show("This will add selected stock to store. Continue?", "Recieve Stock", MessageBoxButtons.OKCancel, MessageBoxIcon.Information) == DialogResult.OK)
            {
                using (PsqlConnection oConn = new PsqlConnection(Solsage_Process_Management_System.Classes.Connect.sConnStr))
                {
                    oConn.Open();

                    foreach (DataGridViewRow dgRow in dgReciveOldStock.Rows)
                    {

                        string sSql = "Insert into SOLMSM ";
                        sSql += "(GeneralItemCode,GenItemDescription,QuantityScanned,UserName,ItemDate)";
                        sSql += "Values ('" + dgRow.Cells["clItemCode"].Value.ToString().Trim() + "','" + dgRow.Cells["clItemDescription"].Value.ToString().Trim() + "','" + dgRow.Cells["clQuantity"].Value.ToString().Trim() + "', '" + Solsage_Process_Management_System.Classes.Global.sLogedInUserName.ToString() + "', '" + lblDateTime.Text + "')";
                        int iReturn = Solsage_Process_Management_System.Classes.Connect.getDataCommand(sSql, oConn).ExecuteNonQuery();

                        sSql = "Insert into SOLMROS ";
                        sSql += "(ItemCode,ItemDescription,Quantity,UserName,Date)";
                        sSql += "Values ('" + dgRow.Cells["clItemCode"].Value.ToString().Trim() + "','" + dgRow.Cells["clItemDescription"].Value.ToString().Trim() + "','" + dgRow.Cells["clQuantity"].Value.ToString().Trim() + "', '" + Solsage_Process_Management_System.Classes.Global.sLogedInUserName.ToString() + "', '" + lblDateTime.Text + "') ";
                        iReturn = Solsage_Process_Management_System.Classes.Connect.getDataCommand(sSql, oConn).ExecuteNonQuery();

                    }

                    oConn.Dispose();
                }
                this.Close();
            }
        }
开发者ID:anthonied,项目名称:LiquidPastel,代码行数:28,代码来源:RecieveOldStock.cs

示例4: FetchVersionDetails

        public static void FetchVersionDetails()
        {
            using (PsqlConnection oConn = new PsqlConnection(Connect.sConnStr))
            {
                try
                {
                    oConn.Open();

                }
                catch (Exception Ex)
                {
                    MessageBox.Show("Error connecting to Liquid Database:" + Ex.ToString(),"Connection Error");
                    Application.Exit();
                }

                string sSql = "SELECT * FROM SOLUPD";
                PsqlDataReader rdReader = Connect.getDataCommand(sSql, oConn).ExecuteReader();
                while (rdReader.Read())
                {
                    iCurrVersion = Convert.ToInt32(rdReader["CurrentVersion"].ToString().Trim());
                }

                rdReader.Close();
            }
        }
开发者ID:anthonied,项目名称:LiquidPastel,代码行数:25,代码来源:DBUpdater.cs

示例5: CalculateCommission

        public static Decimal CalculateCommission(string sCommissionType, string sCommissionCategory, Decimal dInvoiceValue)
        {
            decimal dTotalCommission = 0;
            decimal dCategory = 0;
            decimal dCommissionType = 0;
            //get category percentage
            using (PsqlConnection oConn = new PsqlConnection(Solsage_Process_Management_System.Classes.Connect.sConnStr))
            {
                oConn.Open();
                String sSql = "Select CategoryPercentage from SOLMARKCAT where CategoryName = '" + sCommissionCategory + "'";
                string sPercentage = Solsage_Process_Management_System.Classes.Connect.getDataCommand(sSql, oConn).ExecuteScalar().ToString();
                dCategory = Convert.ToDecimal(sPercentage) / 100;

                try
                {
                    sSql = "Select CommissionPercentage From SOLMARKCOMTIPE where CommissionTipe = '" + sCommissionType + "'";
                    string sComPercentage = Solsage_Process_Management_System.Classes.Connect.getDataCommand(sSql, oConn).ExecuteScalar().ToString();
                    dCommissionType = Convert.ToDecimal(sComPercentage) / 100;
                }
                catch
                {
                    dCommissionType = 1;
                }

                oConn.Dispose();
            }
            dTotalCommission = dInvoiceValue * dCategory * dCommissionType;

            return dTotalCommission;
        }
开发者ID:anthonied,项目名称:LiquidPastel,代码行数:30,代码来源:Functions.cs

示例6: DBLoadRawBatchGrid

        private void DBLoadRawBatchGrid()
        {
            try
            {
                dgvRawBatches.AutoGenerateColumns = false;
                dgvRawBatches.DataSource = null;

                string sSql = "";

                using (PsqlConnection liqConn = new PsqlConnection(Connect.sConnStr))
                {
                    liqConn.Open();

                    sSql = "SELECT * FROM SOLSIL";
                    sSql += " WHERE DocNumber = '" +sDocNumFilter + "'" ;

                    dsRawBatchInfo = Connect.getDataSet(sSql, "RawBatch", liqConn);

                    bsRawBatch = new BindingSource();
                    bsRawBatch.DataSource = dsRawBatchInfo;
                    bsRawBatch.DataMember = dsRawBatchInfo.Tables["RawBatch"].TableName;

                    dgvRawBatches.DataSource = bsRawBatch;

                    liqConn.Close();
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("Error Info: " + ex.Message, "Exception Occurred", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
开发者ID:anthonied,项目名称:LiquidPastel,代码行数:32,代码来源:RawSIBatchZoom.cs

示例7: BusinessUnitTracking_Load

        private void BusinessUnitTracking_Load(object sender, EventArgs e)
        {
            this.WindowState = FormWindowState.Maximized;
            this.ControlBox = false;
            using (PsqlConnection oConn = new PsqlConnection(Solsage_Process_Management_System.Classes.Connect.sConnStr))
            {
                oConn.Open();
                string sSql = "select UnitId, concat(concat(UnitName,' - '),UnitDescription) 'Name'  from SOLMBS order by UnitID";
                DataSet dsUnits = Solsage_Process_Management_System.Classes.Connect.getDataSet(sSql, "Unit", oConn);
                selUnits.DataSource = dsUnits.Tables["Unit"];
                selUnits.DisplayMember = "Name";
                this.txtUnitID.DataBindings.Add(new Binding("Text", dsUnits.Tables["Unit"], "UnitID", true));
                if (loadOperators(oConn))
                {
                    selOperators_SelectedIndexChanged(sender, e);
                    viewSheet(oConn);
                }
                oConn.Dispose();
            }
            DataGridViewCellStyle dgCellStyle = new DataGridViewCellStyle();
            dgCellStyle.BackColor = Color.LightGray;
            dgInput.Columns[0].DefaultCellStyle = dgCellStyle;
            dgInput.Columns[1].DefaultCellStyle = dgCellStyle;
            dgInput.Columns[2].DefaultCellStyle = dgCellStyle;
            dgInput.Columns["cl24"].DefaultCellStyle = dgCellStyle;
            dgInput.Columns["clEntryId"].Width = 0;

            this.txtUnitID.TextChanged += new System.EventHandler(this.txtUnitID_TextChanged);
            this.selOperators.SelectedIndexChanged += new System.EventHandler(this.selOperators_SelectedIndexChanged);
        }
开发者ID:anthonied,项目名称:LiquidPastel,代码行数:30,代码来源:BusinessUnitTracking.cs

示例8: cmdlogin_Click

        private void cmdlogin_Click(object sender, EventArgs e)
        {
            bool bMatch = false;

            using (PsqlConnection oConn = new PsqlConnection(Solsage_Process_Management_System.Classes.Connect.sConnStr))
            {
                oConn.Open();
                string sSql = "Select UserName,Psswrd,Code,UserType from SOLUS where UserName = '" + txtUserName.Text + "'";
                PsqlDataReader rdReader = Solsage_Process_Management_System.Classes.Connect.getDataCommand(sSql, oConn).ExecuteReader();
                while (rdReader.Read())
                {
                    if (txtPassword.Text == rdReader["Psswrd"].ToString().Trim())
                    {
                        bMatch = true;
                        sUserCode = rdReader["Code"].ToString().Trim();
                    }
                }
                rdReader.Close();
                oConn.Dispose();
            }

             if (bMatch == true)
            {
                this.DialogResult = DialogResult.OK;
                this.Close();
            }
            else
            {
                MessageBox.Show("Username and Password does not match.  Please try again.");
                cmdClearFields();
                this.ActiveControl = txtUserName;
            }
        }
开发者ID:anthonied,项目名称:LiquidPastel,代码行数:33,代码来源:VerifyUser.cs

示例9: DBLoadInventoryGrid

        public void DBLoadInventoryGrid()
        {
            try
            {
                dgvInventory.AutoGenerateColumns = false;
                dgvInventory.DataSource = null;

                string sSql = "";

                using (PsqlConnection pasConn = new PsqlConnection(Connect.sPastelConnStr))
                {
                    pasConn.Open();

                    sSql = "SELECT RTRIM(Category) As Category, RTRIM(ItemCode) As ItemCode, RTRIM(Description) AS Description, RTRIM(UnitSize) AS UnitSize, RTRIM(ICDesc) AS ICDesc";
                    sSql += " FROM Inventory";
                    sSql += " LEFT JOIN InventoryCategory ON ICCode = Category ";

                    dsInventory = Connect.getDataSet(sSql, "Inventory", pasConn);

                    bsInventory = new BindingSource();
                    bsInventory.DataSource = dsInventory;
                    bsInventory.DataMember = dsInventory.Tables["Inventory"].TableName;

                    dgvInventory.DataSource = bsInventory;
                    dgvInventory.ClearSelection();

                    pasConn.Close();
                }

            }
            catch(Exception ex)
            {
                MessageBox.Show("Error Info: " + ex.Message, "Exception Occurred", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
开发者ID:anthonied,项目名称:LiquidPastel,代码行数:35,代码来源:ManuInventory.cs

示例10: LoadAssetGrid

        private void LoadAssetGrid()
        {
            dgAllAssetZoom.Rows.Clear();
            string sSelectedStoreCode = "All";
            using (PsqlConnection oConn = new PsqlConnection(Solsage_Process_Management_System.Classes.Connect.sPastelConnStr))
            {
                oConn.Open();
                string sSql = "SELECT distinct  Inventory.ItemCode, Description, UserDefText01, UserDefText02, UserDefText03 from Inventory ";
                sSql += " inner join MultiStoreTrn on Inventory.ItemCode = MultiStoreTrn.ItemCode ";
                sSql += " where (StoreCode = '" + sSelectedStoreCode + "' or '" + sSelectedStoreCode + "' = 'All')and (Inventory.ItemCode like '%" + txtItemCodeFilter.Text + "%' or '" + txtItemCodeFilter.Text + "' = '')";
                sSql += " and UserDefNum01 = 1 ";
                //sSql += " and UserDefText01 = 'WORKSHOP'";
                sSql += " order by Inventory.UserDefText01, Inventory.ItemCode ";

                PsqlDataReader rdReader = Solsage_Process_Management_System.Classes.Connect.getDataCommand(sSql, oConn).ExecuteReader();
                while (rdReader.Read())
                {
                    int n = dgAllAssetZoom.Rows.Add();
                    dgAllAssetZoom.Rows[n].Cells["clItemCode"].Value = rdReader["ItemCode"].ToString();
                    dgAllAssetZoom.Rows[n].Cells["clDescription"].Value = rdReader["Description"].ToString();
                }
                oConn.Dispose();
                rdReader.Close();
            }
        }
开发者ID:anthonied,项目名称:LiquidPastel,代码行数:25,代码来源:AllAssetZoom.cs

示例11: cmdSaveOutWorkshop_Click

        private void cmdSaveOutWorkshop_Click(object sender, EventArgs e)
        {
            using (PsqlConnection oConn = new PsqlConnection(Solsage_Process_Management_System.Classes.Connect.sPastelConnStr))
            {
                oConn.Open();
                for (int i = 0; i < dgTakeOutWorkshop.Rows.Count; i++)
                {
                    if (dgTakeOutWorkshop.Rows[i].Cells["chkSelectOut"].Value == chkSelectOut.TrueValue)
                    {

                        string sSql = "Update Inventory Set ";
                        sSql += "UserDefText01 = '',";
                        sSql += "UserDefText03 = '',";
                        sSql += "UserDefText02 = '' ";
                        sSql += "where ItemCode = '" + this.dgTakeOutWorkshop.Rows[i].Cells[0].Value + "'";

                        int iReturn = Solsage_Process_Management_System.Classes.Connect.getDataCommand(sSql, oConn).ExecuteNonQuery();
                        if (iReturn <= 0)
                        {
                            MessageBox.Show("An error occured with the movement of item " + this.dgTakeOutWorkshop.Rows[i].Cells[0].Value + " to the workshop");

                        }

                    }
                }

                cmdSaveOutWorkshop.Enabled = false;
                oConn.Dispose();
            }
            dgPutInWorkshop.Rows.Clear();
            currentlyOutWorkshopGridLoad();

            dgTakeOutWorkshop.Rows.Clear();
            currentlyInWorkshopGridLoad();
        }
开发者ID:anthonied,项目名称:LiquidPastel,代码行数:35,代码来源:AssetToWorkshop.cs

示例12: Connect

 public void Connect(string dsn, string host)
 {
     Console.Error.Write("Connecting to {0}...", host);
     DBConn = new PsqlConnection(string.Format("Server DSN={0}; Host={1}", dsn, host));
     DBConn.Open();
     Console.Error.WriteLine("connected");
 }
开发者ID:glenn-hill,项目名称:pervasivecl,代码行数:7,代码来源:engine.cs

示例13: LoadAccountDetails

        private void LoadAccountDetails()
        {
            Cursor = System.Windows.Forms.Cursors.WaitCursor;
            dgAccountDetails.Rows.Clear();

            using (PsqlConnection oConn = new PsqlConnection(Solsage_Process_Management_System.Classes.Connect.sConnStr))
            {
                oConn.Open();
                String sSql = "Select Category, CommissionType, InvoiceValue, CustomerCode, DocumentNumber From SOLMARKTRANS where MarketerCode = '" + txtMarketer.Text.Trim() + "' order by CustomerCode";
                PsqlDataReader rdReader = Solsage_Process_Management_System.Classes.Connect.getDataCommand(sSql, oConn).ExecuteReader();
                while (rdReader.Read())
                {
                    int n = dgAccountDetails.Rows.Add();
                    dgAccountDetails.Rows[n].Cells["clCustomerCode"].Value = rdReader[3].ToString();
                    dgAccountDetails.Rows[n].Cells["clDocumentNumber"].Value = rdReader[4].ToString();
                    dgAccountDetails.Rows[n].Cells["clCategory"].Value = rdReader[0].ToString();
                    dgAccountDetails.Rows[n].Cells["clCommissionType"].Value = rdReader[1].ToString();
                    dgAccountDetails.Rows[n].Cells["clInvoiceValue"].Value = rdReader[2].ToString();
                    dgAccountDetails.Rows[n].Cells["clCommissionAmount"].Value = Classes.Functions.CalculateCommission(rdReader[1].ToString(), rdReader[0].ToString(), Convert.ToDecimal(rdReader[2].ToString())).ToString("N2");

                }
                rdReader.Dispose();
                oConn.Dispose();
            }
            AddTotals();
            Cursor = System.Windows.Forms.Cursors.Default;
        }
开发者ID:anthonied,项目名称:LiquidPastel,代码行数:27,代码来源:MarketingAccountDetails.cs

示例14: cmdDeleteKit_Click

        private void cmdDeleteKit_Click(object sender, EventArgs e)
        {
            if (MessageBox.Show("This will permanently delete the current selected Kit Items. Are you sure?", "Delete Kit Items", MessageBoxButtons.YesNo, MessageBoxIcon.Exclamation) == DialogResult.Yes)
            {
                using (PsqlConnection oConn = new PsqlConnection(Solsage_Process_Management_System.Classes.Connect.sConnStr))
                {
                    oConn.Open();
                    foreach (DataGridViewRow dgRow in dgKitMain.Rows)
                    {
                        // Main Kit code
                        if (dgRow.Cells[0].Value != null)
                        {
                            string sDelSql = "delete From SOLKIT where KitName = '" + txtKitName.Text.Trim() + "'";
                            int delRet = Solsage_Process_Management_System.Classes.Connect.getDataCommand(sDelSql, oConn).ExecuteNonQuery();

                            //Kit Details
                            string sDelSql2 = "delete From SOLKITDET where FkMainItemCode = '" + dgRow.Cells["clMainItemCode"].Value.ToString() + "'";
                            int delRet2 = Solsage_Process_Management_System.Classes.Connect.getDataCommand(sDelSql2, oConn).ExecuteNonQuery();
                        }
                    }
                    oConn.Dispose();
                }
                dgKitDetails.Rows.Clear();
                dgKitMain.Rows.Clear();
                txtKitName.Text = "";
            }
            dgKitDetails.Rows.Add();
            dgKitMain.Rows.Add();
        }
开发者ID:anthonied,项目名称:LiquidPastel,代码行数:29,代码来源:KitItemSetup.cs

示例15: LoadData

        private void LoadData()
        {
            using (PsqlConnection oConn = new PsqlConnection(Connect.sConnStr))
            {
                string sSql = "SELECT * FROM SOLTS";

                PsqlDataReader rdReader = Connect.getDataCommand(sSql, oConn).ExecuteReader();
                if (rdReader.HasRows)
                {
                    while (rdReader.Read())
                    {
                        int i = dgvSetup.Rows.Add();

                        dgvSetup.Rows[i].Cells["Customer_Ref"].Value = rdReader["Customer_Ref"].ToString();

                        dgvSetup.Rows[i].Cells["IP_Destination"].Value = rdReader["IP_Destination"].ToString();
                        dgvSetup.Rows[i].Cells["clAlias"].Value = rdReader["Receiver_Alias"].ToString();
                        dgvSetup.Rows[i].Cells["Supplier_Ref"].Value = rdReader["Supplier_Ref"].ToString();
                        dgvSetup.Rows[i].Cells["Data_Path"].Value = rdReader["sData_Path"].ToString();
                        dgvSetup.Rows[i].Cells["SOLPMS_ConnString"].Value = rdReader["SOLPMS_ConnString"].ToString();

                    }
                }

                rdReader.Close();
            }
        }
开发者ID:anthonied,项目名称:LiquidPastel,代码行数:27,代码来源:frmTransferSetup.cs


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