示例#1
0
        public void RefreshDataGridView()
        {
            OleDbConnection connection = null;
            OleDbDataReader dataReader = null;

            try
            {
                this.dataGridView1.Rows.Clear();
                int inum = 0;
                try
                {
                    connection = new OleDbConnection();
                    connection.ConnectionString = this.gLineTestProcessor.dbPathStr;
                    connection.Open();
                    dataReader = new OleDbCommand("select * from TEquipmentFaultRecord order by ID desc", connection).ExecuteReader();
                    this.dataGridView1.AllowUserToAddRows = true;
                    while (dataReader.Read())
                    {
                        this.dataGridView1.Rows.Add(1);
                        int num = inum + 1;
                        this.dataGridView1.Rows[inum].Cells[0].Value = System.Convert.ToString(num);
                        this.dataGridView1.Rows[inum].Cells[1].Value = dataReader["EFaultTime"].ToString();
                        this.dataGridView1.Rows[inum].Cells[2].Value = dataReader["EFaultContent"].ToString();
                        inum = num;
                        if (inum >= ctFormErrorQuery.MAX_SHOW_NUM)
                        {
                            break;
                        }
                    }
                    this.dataGridView1.AllowUserToAddRows = false;
                    dataReader.Close();
                    dataReader = null;
                    connection.Close();
                    connection = null;
                    if (this.dataGridView1.Rows.Count > 0)
                    {
                        this.dataGridView1.Rows[0].Selected = false;
                    }
                }
                catch (System.Exception ex)
                {
                    this.dataGridView1.AllowUserToAddRows = false;
                    KLineTestProcessor.ExceptionRecordFunc(ex.StackTrace);
                    if (dataReader != null)
                    {
                        dataReader.Close();
                        dataReader = null;
                    }
                    if (connection != null)
                    {
                        connection.Close();
                        connection = null;
                    }
                }
            }
            catch (System.Exception ex2)
            {
                KLineTestProcessor.ExceptionRecordFunc(ex2.StackTrace);
            }
        }
        public void RefreshDataGridView()
        {
            OleDbConnection connection = null;
            OleDbDataReader dataReader = null;

            try
            {
                this.dataGridView1.Rows.Clear();
                int inum = 0;
                try
                {
                    connection = new OleDbConnection();
                    connection.ConnectionString = this.gLineTestProcessor.dbPathStr;
                    connection.Open();
                    dataReader = new OleDbCommand("select * from TConnectorLibrary order by ID", connection).ExecuteReader();
                    this.dataGridView1.AllowUserToAddRows = true;
                    while (dataReader.Read())
                    {
                        this.dataGridView1.Rows.Add(1);
                        int num = inum + 1;
                        this.dataGridView1.Rows[inum].Cells[0].Value = System.Convert.ToString(num);
                        this.strIDArray[inum] = dataReader["ID"].ToString();
                        this.dataGridView1.Rows[inum].Cells[1].Value = dataReader["ConnectorName"].ToString();
                        this.dataGridView1.Rows[inum].Cells[2].Value = dataReader["ConverterType"].ToString();
                        this.dataGridView1.Rows[inum].Cells[3].Value = dataReader["PinNum"].ToString();
                        this.dataGridView1.Rows[inum].Cells[4].Value = dataReader["Remark"].ToString();
                        inum = num;
                        if (inum >= 5000)
                        {
                            break;
                        }
                    }
                    this.dataGridView1.AllowUserToAddRows = false;
                    dataReader.Close();
                    dataReader = null;
                    connection.Close();
                    connection = null;
                }
                catch (System.Exception arg_1AD_0)
                {
                    this.dataGridView1.AllowUserToAddRows = false;
                    KLineTestProcessor.ExceptionRecordFunc(arg_1AD_0.StackTrace);
                    if (dataReader != null)
                    {
                        dataReader.Close();
                        dataReader = null;
                    }
                    if (connection != null)
                    {
                        connection.Close();
                        connection = null;
                    }
                }
            }
            catch (System.Exception arg_1D1_0)
            {
                KLineTestProcessor.ExceptionRecordFunc(arg_1D1_0.StackTrace);
            }
        }
示例#3
0
        public void xhglDealwithFunc()
        {
            OleDbConnection connection = null;
            OleDbDataReader dataReader = null;

            try
            {
                this.dataGridView2.Rows.Clear();
                int    inum2   = 0;
                string dbpath  = Application.StartupPath + "\\ctsdb.mdb";
                string ifNoStr = this.textBox_InterfaceNo.Text.ToString().Trim();
                try
                {
                    connection = new OleDbConnection();
                    connection.ConnectionString = this.gLineTestProcessor.dbPathStr;
                    connection.Open();
                    dataReader = new OleDbCommand((!string.IsNullOrEmpty(ifNoStr)) ? ("select * from TPlugLibrary where PlugNo like '%" + ifNoStr + "%' order by PlugNo") : "select * from TPlugLibrary order by PlugNo", connection).ExecuteReader();
                    this.dataGridView2.AllowUserToAddRows = true;
                    while (dataReader.Read())
                    {
                        this.dataGridView2.Rows.Add(1);
                        int num = inum2 + 1;
                        this.dataGridView2.Rows[inum2].Cells[0].Value = System.Convert.ToString(num);
                        this.dataGridView2.Rows[inum2].Cells[1].Value = dataReader["PlugNo"].ToString();
                        this.dataGridView2.Rows[inum2].Cells[2].Value = dataReader["PinNum"].ToString();
                        inum2 = num;
                        if (inum2 > 5000)
                        {
                            break;
                        }
                    }
                    dataReader.Close();
                    dataReader = null;
                    this.dataGridView2.AllowUserToAddRows = false;
                    connection.Close();
                    connection = null;
                }
                catch (System.Exception arg_17C_0)
                {
                    this.dataGridView2.AllowUserToAddRows = false;
                    KLineTestProcessor.ExceptionRecordFunc(arg_17C_0.StackTrace);
                    if (dataReader != null)
                    {
                        dataReader.Close();
                        dataReader = null;
                    }
                    if (connection != null)
                    {
                        connection.Close();
                        connection = null;
                    }
                }
            }
            catch (System.Exception arg_1A0_0)
            {
                KLineTestProcessor.ExceptionRecordFunc(arg_1A0_0.StackTrace);
            }
        }
示例#4
0
        public void RefreshControlFunc()
        {
            OleDbConnection connection = null;
            OleDbDataReader dataReader = null;

            try
            {
                this.comboBox_jkdh.Items.Clear();
                this.comboBox_jkdh.Items.Add("所有接口");
                string tempStr = "";
                try
                {
                    connection = new OleDbConnection();
                    connection.ConnectionString = this.gLineTestProcessor.dbPathStr;
                    connection.Open();
                    dataReader = new OleDbCommand("select * from TLineStructLibrary where LineStructName='" + this.gtpsCableStr + "'", connection).ExecuteReader();
                    if (dataReader.Read())
                    {
                        tempStr = dataReader["PlugInfo"].ToString();
                    }
                    dataReader.Close();
                    dataReader = null;
                    connection.Close();
                    connection = null;
                }
                catch (System.Exception arg_A6_0)
                {
                    KLineTestProcessor.ExceptionRecordFunc(arg_A6_0.StackTrace);
                    if (dataReader != null)
                    {
                        dataReader.Close();
                        dataReader = null;
                    }
                    if (connection != null)
                    {
                        connection.Close();
                        connection = null;
                    }
                }
                string[] tempStrArray = tempStr.Split(new char[]
                {
                    ','
                });
                for (int i = 0; i < tempStrArray.Length; i++)
                {
                    if (!string.IsNullOrEmpty(tempStrArray[i]))
                    {
                        this.comboBox_jkdh.Items.Add(tempStrArray[i]);
                    }
                }
            }
            catch (System.Exception arg_114_0)
            {
                KLineTestProcessor.ExceptionRecordFunc(arg_114_0.StackTrace);
            }
            this.comboBox_jkdh.SelectedIndex = 0;
        }
        public void RefreshDataGridView()
        {
            OleDbConnection connection = null;
            OleDbDataReader dataReader = null;

            try
            {
                this.dataGridView1.Rows.Clear();
                int    inum   = 0;
                string dbpath = Application.StartupPath + "\\ctsdb.mdb";
                try
                {
                    connection = new OleDbConnection();
                    connection.ConnectionString = this.gLineTestProcessor.dbPathStr;
                    connection.Open();
                    dataReader = new OleDbCommand("select * from TConnectorLibrary order by ConnectorName", connection).ExecuteReader();
                    while (dataReader.Read())
                    {
                        string temp1Str = dataReader["ConnectorName"].ToString();
                        string temp2Str = dataReader["PinNum"].ToString();
                        this.dataGridView1.AllowUserToAddRows = true;
                        this.dataGridView1.Rows.Add(1);
                        int num = inum + 1;
                        this.dataGridView1.Rows[inum].Cells[0].Value = System.Convert.ToString(num);
                        this.dataGridView1.Rows[inum].Cells[1].Value = temp1Str;
                        this.dataGridView1.Rows[inum].Cells[2].Value = temp2Str;
                        this.dataGridView1.AllowUserToAddRows        = false;
                        inum = num;
                    }
                    dataReader.Close();
                    dataReader = null;
                    connection.Close();
                    connection = null;
                }
                catch (System.Exception arg_144_0)
                {
                    this.dataGridView1.AllowUserToAddRows = false;
                    KLineTestProcessor.ExceptionRecordFunc(arg_144_0.StackTrace);
                    if (dataReader != null)
                    {
                        dataReader.Close();
                        dataReader = null;
                    }
                    if (connection != null)
                    {
                        connection.Close();
                        connection = null;
                    }
                }
            }
            catch (System.Exception arg_168_0)
            {
                KLineTestProcessor.ExceptionRecordFunc(arg_168_0.StackTrace);
            }
        }
示例#6
0
        public void RefreshDataGridView2()
        {
            OleDbConnection connection = null;
            OleDbDataReader dataReader = null;

            try
            {
                this.dataGridView2.Rows.Clear();
                int    inum2  = 0;
                string dbpath = Application.StartupPath + "\\ctsdb.mdb";
                try
                {
                    connection = new OleDbConnection();
                    connection.ConnectionString = this.gLineTestProcessor.dbPathStr;
                    connection.Open();
                    dataReader = new OleDbCommand("select top " + 5000 + " * from TPlugLibrary order by PlugNo", connection).ExecuteReader();
                    this.dataGridView2.AllowUserToAddRows = true;
                    while (dataReader.Read())
                    {
                        this.dataGridView2.Rows.Add(1);
                        int num = inum2 + 1;
                        this.dataGridView2.Rows[inum2].Cells[0].Value = System.Convert.ToString(num);
                        this.dataGridView2.Rows[inum2].Cells[1].Value = dataReader["PlugNo"].ToString();
                        this.dataGridView2.Rows[inum2].Cells[2].Value = dataReader["PinNum"].ToString();
                        inum2 = num;
                    }
                    dataReader.Close();
                    dataReader = null;
                    this.dataGridView2.AllowUserToAddRows = false;
                    connection.Close();
                    connection = null;
                }
                catch (System.Exception arg_155_0)
                {
                    this.dataGridView2.AllowUserToAddRows = false;
                    KLineTestProcessor.ExceptionRecordFunc(arg_155_0.StackTrace);
                    if (dataReader != null)
                    {
                        dataReader.Close();
                        dataReader = null;
                    }
                    if (connection != null)
                    {
                        connection.Close();
                        connection = null;
                    }
                }
            }
            catch (System.Exception arg_179_0)
            {
                KLineTestProcessor.ExceptionRecordFunc(arg_179_0.StackTrace);
            }
        }
示例#7
0
        public void QueryUpdateProjectInfoFunc(int iIndex, int iEditPid)
        {
            OleDbConnection connection = null;
            OleDbDataReader dataReader = null;

            try
            {
                try
                {
                    connection = new OleDbConnection();
                    connection.ConnectionString = this.gLineTestProcessor.dbPathStr;
                    connection.Open();
                    dataReader = new OleDbCommand("select top 1 * from TProjectInfo where ID=" + iEditPid, connection).ExecuteReader();
                    if (dataReader.Read())
                    {
                        string cpStr = dataReader["iCommonProject"].ToString();
                        if (cpStr == "1")
                        {
                            this.dataGridView1.Rows[iIndex].Cells[4].Value = "是";
                        }
                        else
                        {
                            this.dataGridView1.Rows[iIndex].Cells[4].Value = "否";
                        }
                        this.dataGridView1.Rows[iIndex].Cells[3].Value = dataReader["batchMumberStr"].ToString();
                        this.dataGridView1.Rows[iIndex].Cells[2].Value = dataReader["bcCableName"].ToString();
                        this.dataGridView1.Rows[iIndex].Cells[5].Value = dataReader["Remark"].ToString();
                    }
                    dataReader.Close();
                    dataReader = null;
                    connection.Close();
                    connection = null;
                }
                catch (System.Exception arg_15F_0)
                {
                    KLineTestProcessor.ExceptionRecordFunc(arg_15F_0.StackTrace);
                    if (dataReader != null)
                    {
                        dataReader.Close();
                        dataReader = null;
                    }
                    if (connection != null)
                    {
                        connection.Close();
                        connection = null;
                    }
                }
            }
            catch (System.Exception arg_183_0)
            {
                KLineTestProcessor.ExceptionRecordFunc(arg_183_0.StackTrace);
            }
        }
        private void FormEquipmentInfoManage_Load(object sender, System.EventArgs e)
        {
            OleDbConnection connection = null;
            OleDbDataReader dataReader = null;

            try
            {
                byte readOnly = (!this.bIsAdminFlag) ? 1 : 0;
                this.textBox_DLCSY_Model.ReadOnly = (readOnly != 0);
                byte readOnly2 = (!this.bIsAdminFlag) ? 1 : 0;
                this.textBox_DLCSY_SN.ReadOnly = (readOnly2 != 0);
                byte enabled = (!this.bIsAdminFlag) ? 1 : 0;
                this.timer_move.Enabled = (enabled != 0);
                byte e2 = (!this.bIsAdminFlag) ? 1 : 0;
                this.label_note.Visible = (e2 != 0);
                string dbpath = Application.StartupPath + "\\ctsdb.mdb";
                try
                {
                    connection = new OleDbConnection();
                    connection.ConnectionString = this.gLineTestProcessor.dbPathStr;
                    connection.Open();
                    dataReader = new OleDbCommand("select top 1 * from TTestEquipmentInfo", connection).ExecuteReader();
                    if (dataReader.Read())
                    {
                        this.textBox_DLCSY_Model.Text = dataReader["TestEquipmentModel"].ToString();
                        this.textBox_DLCSY_SN.Text    = dataReader["TestEquipmentSN"].ToString();
                    }
                    dataReader.Close();
                    dataReader = null;
                    connection.Close();
                    connection = null;
                }
                catch (System.Exception arg_105_0)
                {
                    if (dataReader != null)
                    {
                        dataReader.Close();
                        dataReader = null;
                    }
                    if (connection != null)
                    {
                        connection.Close();
                        connection = null;
                    }
                    KLineTestProcessor.ExceptionRecordFunc(arg_105_0.StackTrace);
                }
            }
            catch (System.Exception arg_113_0)
            {
                KLineTestProcessor.ExceptionRecordFunc(arg_113_0.StackTrace);
            }
        }
示例#9
0
        private void FormLogin_Load(object sender, System.EventArgs e)
        {
            OleDbConnection connection = null;
            OleDbDataReader dataReader = null;

            try
            {
                this.loginUser      = "";
                this.loginSecr      = "";
                this.loginName      = "";
                this.bIsAdminFlag   = false;
                this.bLoginSuccFlag = false;
                try
                {
                    connection = new OleDbConnection();
                    connection.ConnectionString = this.gLineTestProcessor.dbPathStr;
                    connection.Open();
                    dataReader = new OleDbCommand("select top 1 * from TLoginRecord order by ID desc", connection).ExecuteReader();
                    if (dataReader.Read())
                    {
                        string tempStr = dataReader["LoginUser"].ToString();
                        if (!string.IsNullOrEmpty(tempStr))
                        {
                            this.textBox_UserName.Text = tempStr;
                        }
                    }
                    dataReader.Close();
                    connection.Close();
                    dataReader = null;
                    connection = null;
                }
                catch (System.Exception arg_BC_0)
                {
                    if (dataReader != null)
                    {
                        dataReader.Close();
                        dataReader = null;
                    }
                    if (connection != null)
                    {
                        connection.Close();
                        connection = null;
                    }
                    KLineTestProcessor.ExceptionRecordFunc(arg_BC_0.StackTrace);
                }
                this.textBox_Password.Focus();
            }
            catch (System.Exception ex_D6)
            {
            }
        }
        public void GLDealwithFunc()
        {
            OleDbConnection connection = null;
            OleDbDataReader dataReader = null;

            try
            {
                this.comboBox_it.Items.Clear();
                this.connectorNameStrArray.Clear();
                string cNameStr = this.textBox_Connector.Text.ToString().Trim();
                try
                {
                    connection = new OleDbConnection();
                    string dbpath = Application.StartupPath + "\\ctsdb.mdb";
                    connection.ConnectionString = this.gLineTestProcessor.dbPathStr;
                    connection.Open();
                    dataReader = new OleDbCommand((!string.IsNullOrEmpty(cNameStr)) ? ("select * from TConnectorLibrary where ConnectorName like '%" + cNameStr + "%' order by ConnectorName") : "select * from TConnectorLibrary order by ConnectorName", connection).ExecuteReader();
                    while (dataReader.Read())
                    {
                        this.connectorNameStrArray.Add(dataReader["ConnectorName"].ToString());
                    }
                    dataReader.Close();
                    dataReader = null;
                    connection.Close();
                    connection = null;
                }
                catch (System.Exception arg_CA_0)
                {
                    KLineTestProcessor.ExceptionRecordFunc(arg_CA_0.StackTrace);
                    if (dataReader != null)
                    {
                        dataReader.Close();
                        dataReader = null;
                    }
                    if (connection != null)
                    {
                        connection.Close();
                        connection = null;
                    }
                }
                for (int i = 0; i < this.connectorNameStrArray.Count; i++)
                {
                    this.comboBox_it.Items.Add(this.connectorNameStrArray[i]);
                }
            }
            catch (System.Exception arg_121_0)
            {
                KLineTestProcessor.ExceptionRecordFunc(arg_121_0.StackTrace);
            }
        }
        private void ctFormInterfaceTypeImportPin_Load(object sender, System.EventArgs e)
        {
            OleDbConnection connection = null;
            OleDbDataReader dataReader = null;

            try
            {
                this.comboBox_it.Items.Clear();
                this.connectorNameStrArray.Clear();
                try
                {
                    connection = new OleDbConnection();
                    string dbpath = Application.StartupPath + "\\ctsdb.mdb";
                    connection.ConnectionString = this.gLineTestProcessor.dbPathStr;
                    connection.Open();
                    dataReader = new OleDbCommand("select * from TConnectorLibrary order by ConnectorName", connection).ExecuteReader();
                    while (dataReader.Read())
                    {
                        this.connectorNameStrArray.Add(dataReader["ConnectorName"].ToString());
                    }
                    dataReader.Close();
                    dataReader = null;
                    connection.Close();
                    connection = null;
                }
                catch (System.Exception arg_94_0)
                {
                    KLineTestProcessor.ExceptionRecordFunc(arg_94_0.StackTrace);
                    if (dataReader != null)
                    {
                        dataReader.Close();
                        dataReader = null;
                    }
                    if (connection != null)
                    {
                        connection.Close();
                        connection = null;
                    }
                }
                for (int i = 0; i < this.connectorNameStrArray.Count; i++)
                {
                    this.comboBox_it.Items.Add(this.connectorNameStrArray[i]);
                }
            }
            catch (System.Exception arg_EB_0)
            {
                KLineTestProcessor.ExceptionRecordFunc(arg_EB_0.StackTrace);
            }
        }
示例#12
0
 private void btnOK_Click(object sender, EventArgs e)
 {
     if (frmBase.Me_Conn.State == ConnectionState.Open)
     {
         string format = "SELECT memb_guid FROM MEMB_INFO WHERE memb___id = '{0}'";
         try
         {
             if (!Validator.UserName(this.txtAccount.Text.Trim()))
             {
                 Utils.WarningMessage("Error: Account names must be between 4-10 characters, and only contain numbers, letters or underscores.");
             }
             else if (!Validator.PassWord(this.txtPwd.Text.Trim()))
             {
                 Utils.WarningMessage("Error: Passwords must be between 4-10 characters.");
             }
             else
             {
                 format = string.Format(format, this.txtAccount.Text.Trim());
                 OleDbDataReader reader = new OleDbCommand(format, frmBase.Me_Conn).ExecuteReader();
                 if (reader.Read())
                 {
                     Utils.WarningMessage("Error: The account [" + this.txtAccount.Text.Trim() + "] already exists.");
                     reader.Close();
                 }
                 else
                 {
                     reader.Close();
                     object[] args = new object[] { this.txtAccount.Text.Trim(), this.txtPwd.Text.Trim(), this.txtAccount.Text.Trim() + "@email.pl", 0, 1 };
                     format = string.Format("INSERT INTO dbo.MEMB_INFO(memb___id, memb__pwd, memb_name, mail_addr, fpas_ques, fpas_answ, sno__numb, post_code, bloc_code, ctl1_code) VALUES ('{0}', '{1}', 'EMU','{2}', 'question', 'answer', 0, '{4}', 0, 0)", args);
                     //format = string.Format("DECLARE @Result_Data tinyint; EXEC [dbo].[CreateAccount] @memb___id = N'{0}',@membwebid = N'{0}', @memb__pwd = N'{1}', @mail_addr = N'{2}', @Area_Code = {4}, @Result_Data = @Result_Data OUTPUT; SELECT @Result_Data as N'@Result_Data'", args);
                     if (base.Me_ExecuteSQL(format))
                     {
                         Utils.InfoMessage("Account created.");
                     }
                     else
                     {
                         Utils.WarningMessage("Error: Account creation failed.");
                     }
                 }
             }
         }
         catch (Exception exception)
         {
             Utils.WarningMessage("SQL:" + format + "\nError:" + exception.Message + "\nSource:" + exception.Source + "\nTrace:" + exception.StackTrace);
         }
     }
 }
        public bool CableUsedQueryFunc(string queryStr)
        {
            OleDbConnection connection = null;

            OleDbDataReader dataReader = null;
            bool            bExistFlag = false;

            try
            {
                try
                {
                    connection = new OleDbConnection();
                    connection.ConnectionString = this.gLineTestProcessor.dbPathStr;
                    connection.Open();
                    dataReader = new OleDbCommand("select * from TPlugLibrary where ConnectorName='" + queryStr + "'", connection).ExecuteReader();
                    if (dataReader.Read())
                    {
                        this.usedPlugStr = dataReader["PlugNo"].ToString();
                        bExistFlag       = true;
                    }
                    dataReader.Close();
                    dataReader = null;
                    connection.Close();
                    connection = null;
                }
                catch (System.Exception arg_76_0)
                {
                    KLineTestProcessor.ExceptionRecordFunc(arg_76_0.StackTrace);
                    if (dataReader != null)
                    {
                        dataReader.Close();
                        dataReader = null;
                    }
                    if (connection != null)
                    {
                        connection.Close();
                        connection = null;
                    }
                }
            }
            catch (System.Exception arg_9A_0)
            {
                KLineTestProcessor.ExceptionRecordFunc(arg_9A_0.StackTrace);
            }
            return(bExistFlag);
        }
示例#14
0
        public object[] DLookupA(string table, string fieldName, string clauses, string[] orderByFieldNames, bool orderByAsc)
        {
            List <object> data       = new List <object>();
            bool          connectedP = isConnectedDo;
            string        query      = "";

            try
            {
                query = "SELECT " + fieldName + " FROM " + table + " WHERE (" + clauses + ")" + ((orderByFieldNames.Length > 0) ? " ORDER BY " + getOrderByData(orderByFieldNames) + " " + ((orderByAsc) ? "ASC" : "DESC") : "");

                if (dbType == DatabaseType.MSSQL)
                {
                    getQueryDbChanger(query, SqlTypes.SELECT);
                    SqlDataReader Dr = new SqlCommand(query, MSSQLConn).ExecuteReader();
                    while (Dr.Read())
                    {
                        data.Add(Dr[0]);
                    }
                    Dr.Close();
                }
                else if (dbType == DatabaseType.MYSQL)
                {
                    MySqlDataReader Dr = new MySqlCommand(query, MySQLConn).ExecuteReader();
                    while (Dr.Read())
                    {
                        data.Add(Dr[0]);
                    }
                    Dr.Close();
                }
                else if (dbType == DatabaseType.MSACCESS2003 | dbType == DatabaseType.MSACCESS2007)
                {
                    OleDbDataReader Dr = new OleDbCommand(query, MSDBSQLConn).ExecuteReader();
                    while (Dr.Read())
                    {
                        data.Add(Dr[0]);
                    }
                    Dr.Close();
                }
            }
            catch (Exception eee)
            {
                OnError(eee);
                data.Clear();
                data.Add("ERROR: " + eee.Message);
                data.Add("ERRORI: " + table);
                data.Add("ERRORI: " + fieldName);
                data.Add("ERRORI: " + clauses);
                data.Add("ERRORI: " + query);
            }
            finally
            {
                if (!connectedP)
                {
                    closeConnection();
                }
            }
            return(data.ToArray());
        }
示例#15
0
        private void FormUpdateUser_Load(object sender, System.EventArgs e)
        {
            OleDbConnection connection = null;
            OleDbDataReader dataReader = null;

            try
            {
                this.textBox_user.Text = this.userStr;
                try
                {
                    connection = new OleDbConnection();
                    connection.ConnectionString = this.gLineTestProcessor.dbPathStr;
                    connection.Open();
                    dataReader = new OleDbCommand("select * from TUser where UEnabled=1 and UEID='" + KLineTestProcessor.EncrypDisposeFunc(this.userStr) + "'", connection).ExecuteReader();
                    if (dataReader.Read())
                    {
                        this.textBox_name.Text = dataReader["UNAME"].ToString();
                        string tempStr = dataReader["UPWD"].ToString();
                        this.textBox_psw.Text = KLineTestProcessor.DecodeDisposeFunc(tempStr);
                    }
                    dataReader.Close();
                    dataReader = null;
                    connection.Close();
                    connection = null;
                }
                catch (System.Exception arg_BA_0)
                {
                    KLineTestProcessor.ExceptionRecordFunc(arg_BA_0.StackTrace);
                    if (dataReader != null)
                    {
                        dataReader.Close();
                        dataReader = null;
                    }
                    if (connection != null)
                    {
                        connection.Close();
                        connection = null;
                    }
                }
            }
            catch (System.Exception arg_E0_0)
            {
                KLineTestProcessor.ExceptionRecordFunc(arg_E0_0.StackTrace);
            }
        }
        public void QueryUpdateConnectorInfoFunc(int iIndex, int iEditPid)
        {
            OleDbConnection connection = null;
            OleDbDataReader dataReader = null;

            try
            {
                try
                {
                    connection = new OleDbConnection();
                    connection.ConnectionString = this.gLineTestProcessor.dbPathStr;
                    connection.Open();
                    dataReader = new OleDbCommand("select top 1 * from TConnectorLibrary where ID=" + iEditPid, connection).ExecuteReader();
                    if (dataReader.Read())
                    {
                        this.dataGridView1.Rows[iIndex].Cells[2].Value = dataReader["ConverterType"].ToString();
                        this.dataGridView1.Rows[iIndex].Cells[3].Value = dataReader["PinNum"].ToString();
                        this.dataGridView1.Rows[iIndex].Cells[4].Value = dataReader["Remark"].ToString();
                    }
                    dataReader.Close();
                    dataReader = null;
                    connection.Close();
                    connection = null;
                }
                catch (System.Exception arg_ED_0)
                {
                    KLineTestProcessor.ExceptionRecordFunc(arg_ED_0.StackTrace);
                    if (dataReader != null)
                    {
                        dataReader.Close();
                        dataReader = null;
                    }
                    if (connection != null)
                    {
                        connection.Close();
                        connection = null;
                    }
                }
            }
            catch (System.Exception arg_111_0)
            {
                KLineTestProcessor.ExceptionRecordFunc(arg_111_0.StackTrace);
            }
        }
示例#17
0
        public void RefreshFormControlFunc()
        {
            OleDbConnection connection = null;
            OleDbDataReader dataReader = null;

            try
            {
                try
                {
                    connection = new OleDbConnection();
                    connection.ConnectionString = this.gLineTestProcessor.dbPathStr;
                    connection.Open();
                    dataReader = new OleDbCommand("select * from TConverterLibrary where ID = " + this.iEditPid, connection).ExecuteReader();
                    if (dataReader.Read())
                    {
                        this.textBox_name.Text          = dataReader["ConverterName"].ToString();
                        this.textBox_ConverterType.Text = dataReader["ConverterType"].ToString();
                        this.textBox_Remark.Text        = dataReader["Remark"].ToString();
                    }
                    dataReader.Close();
                    dataReader = null;
                    connection.Close();
                    connection = null;
                }
                catch (System.Exception arg_AD_0)
                {
                    KLineTestProcessor.ExceptionRecordFunc(arg_AD_0.StackTrace);
                    if (dataReader != null)
                    {
                        dataReader.Close();
                        dataReader = null;
                    }
                    if (connection != null)
                    {
                        connection.Close();
                        connection = null;
                    }
                }
            }
            catch (System.Exception arg_D1_0)
            {
                KLineTestProcessor.ExceptionRecordFunc(arg_D1_0.StackTrace);
            }
        }
示例#18
0
        public object DLookup(string table, string fieldName, string clauses, string[] orderByFieldNames, bool orderByAsc)
        {
            object data       = null;
            bool   connectedP = isConnectedDo;

            try
            {
                string query = "SELECT TOP 1 " + fieldName + " FROM " + table + " WHERE (" + clauses + ")" + ((orderByFieldNames.Length > 0) ? " ORDER BY " + getOrderByData(orderByFieldNames) + " " + ((orderByAsc) ? "ASC" : "DESC") : "");

                if (dbType == DatabaseType.MSSQL)
                {
                    getQueryDbChanger(query, SqlTypes.SELECT);
                    SqlDataReader Dr = new SqlCommand(query, MSSQLConn).ExecuteReader();
                    if (Dr.Read())
                    {
                        data = Dr[0];
                    }
                    Dr.Close();
                }
                else if (dbType == DatabaseType.MYSQL)
                {
                    MySqlDataReader Dr = new MySqlCommand(query, MySQLConn).ExecuteReader();
                    if (Dr.Read())
                    {
                        data = Dr[0];
                    }
                    Dr.Close();
                }
                else if (dbType == DatabaseType.MSACCESS2003 | dbType == DatabaseType.MSACCESS2007)
                {
                    OleDbDataReader Dr = new OleDbCommand(query, MSDBSQLConn).ExecuteReader();
                    if (Dr.Read())
                    {
                        data = Dr[0];
                    }
                    Dr.Close();
                }
            }
            catch (Exception eee)
            {
                OnError(eee);
                data = eee.Message;
            }
            finally
            {
                if (!connectedP)
                {
                    closeConnection();
                }
            }
            return(data);
        }
示例#19
0
        static void ImportDataFromExcelEquity()
        {
            using (EdisRepository edisRepo = new EdisRepository()) {
                Console.WriteLine("Program start......");
                //string excelFilePath = "C:/Users/ahksysuser06/Desktop/EDISData/Australian Equity Daily Closing Price 20131211.xlsx";
                string excelFilePath = "C:/Users/ahksysuser06/Desktop/EDISData/International_Equity_Daily_Closing_Price_20131211.xlsx";
                // make sure your sheet name is correct, here sheet name is sheet1, so you can change the sheet name if have    different
                string excelQuery = "select SecId,Name,Symbol from [Sheet1$]";
                try
                {
                    string excelConnectionString = @"Provider=Microsoft.ACE.OLEDB.12.0;Data Source=" + excelFilePath +
                                                   ";Extended Properties='Excel 12.0;HDR=YES;IMEX=1;'";
                    OleDbConnection oleConn = new OleDbConnection(excelConnectionString);
                    oleConn.Open();
                    OleDbDataReader oleReader = new OleDbCommand(excelQuery, oleConn).ExecuteReader();
                    //while (oleReader.Read())
                    //{
                    //    Domain.Portfolio.AggregateRoots.Asset.Equity equity = new AustralianEquity(edisRepo)
                    //    {
                    //        Name = oleReader.GetString(1),
                    //        Sector = oleReader.GetString(0),
                    //        Ticker = oleReader.GetString(2),
                    //        EquityType = EquityTypes.AustralianEquity,
                    //    };
                    //    Console.WriteLine("inserting");
                    //    edisRepo.InsertEquityData(equity);
                    //}
                    while (oleReader.Read())
                    {
                        Domain.Portfolio.AggregateRoots.Asset.Equity equity = new InternationalEquity(edisRepo)
                        {
                            Name       = oleReader.GetString(1),
                            Sector     = oleReader.GetString(0),
                            Ticker     = oleReader.GetString(2),
                            EquityType = EquityTypes.InternationalEquity,
                        };
                        Console.WriteLine("inserting");
                        edisRepo.InsertEquityData(equity);
                    }
                    oleReader.Close();
                    oleConn.Close();
                    Console.WriteLine("Finished");
                }

                catch (Exception ex)
                {
                    Console.WriteLine(ex.Message);
                    throw;
                }
            }
        }
示例#20
0
    static void Output(string title)
    {
        string          sql = "SELECT empno id, ename name FROM emp order by id";
        OleDbDataReader dr  = new OleDbCommand(sql, cn).ExecuteReader();

        Console.WriteLine(title + ":");
        while (dr.Read())
        {
            Console.WriteLine("{0, -10}\t{1, -10}",
                              dr[0].ToString().Trim(), dr[1].ToString().Trim());
        }
        Console.WriteLine();
        dr.Close();
    }
示例#21
0
        public List <ARCHIVE> GET_ARCHIVE()
        {
            OleDbDataReader reader      = new OleDbCommand(SQL_GET_ARCHIVE_ALL, myConnection).ExecuteReader();
            List <ARCHIVE>  listArchive = new List <ARCHIVE>();

            while (reader.Read())
            {
                listArchive.Add(new ARCHIVE(reader[0].ToString(), reader[1].ToString(), reader[2].ToString(), reader[3].ToString(), reader[4].ToString()));
            }

            reader.Close();

            return(listArchive);
        }
示例#22
0
        public object DLookup(string sqlQuery)
        {
            object data       = null;
            bool   connectedP = isConnectedDo;

            try
            {
                if (dbType == DatabaseType.MSSQL)
                {
                    getQueryDbChanger(sqlQuery, SqlTypes.SELECT);
                    SqlDataReader Dr = new SqlCommand(sqlQuery, MSSQLConn).ExecuteReader();
                    if (Dr.Read())
                    {
                        data = Dr[0];
                    }
                    Dr.Close();
                }
                else if (dbType == DatabaseType.MYSQL)
                {
                    MySqlDataReader Dr = new MySqlCommand(sqlQuery, MySQLConn).ExecuteReader();
                    if (Dr.Read())
                    {
                        data = Dr[0];
                    }
                    Dr.Close();
                }
                else if (dbType == DatabaseType.MSACCESS2003 | dbType == DatabaseType.MSACCESS2007)
                {
                    OleDbDataReader Dr = new OleDbCommand(sqlQuery, MSDBSQLConn).ExecuteReader();
                    if (Dr.Read())
                    {
                        data = Dr[0];
                    }
                    Dr.Close();
                }
            }
            catch (Exception eee)
            {
                OnError(eee);
                data = eee.Message;
            }
            finally
            {
                if (!connectedP)
                {
                    closeConnection();
                }
            }
            return(data);
        }
示例#23
0
        public List <LOCATION> GET_LOCATION()
        {
            OleDbDataReader reader       = new OleDbCommand(SQL_GET_LOCATION, myConnection).ExecuteReader();
            List <LOCATION> listLocation = new List <LOCATION>();

            while (reader.Read())
            {
                listLocation.Add(new LOCATION(Convert.ToInt32(reader[0]), reader[1].ToString()));
            }

            reader.Close();

            return(listLocation);
        }
示例#24
0
        public void UploadResourceFile(HttpPostedFile postedFile, string dataType)
        {
            var fileName = BusinessLayerParameters.UserDocumentFolderPrefix + postedFile.FileName;
            var filePath = HttpContext.Current.Server.MapPath(fileName);

            postedFile.SaveAs(filePath);

            string excelFilePath = filePath;
            string excelQuery    = "select * from [Sheet1$]";

            string excelConnectionString = @"Provider=Microsoft.ACE.OLEDB.12.0;Data Source=" + excelFilePath +
                                           ";Extended Properties='Excel 12.0;HDR=YES;IMEX=1;'";
            OleDbConnection oleConn = new OleDbConnection(excelConnectionString);

            oleConn.Open();
            OleDbDataReader oleReader = new OleDbCommand(excelQuery, oleConn).ExecuteReader();

            try {
                UploadDataTypes type = (UploadDataTypes)Int32.Parse(dataType);
                switch (type)
                {
                case UploadDataTypes.AssetPrice:
                    FeedExcelDataForAssetPrice(oleReader);
                    break;

                case UploadDataTypes.BondInfo:
                    FeedExcelDataForBonds(oleReader);
                    break;

                case UploadDataTypes.EquityInfo:
                    FeedExcelDataForEquities(oleReader);
                    break;

                case UploadDataTypes.ResearchValue:
                    FeedExcelDataForResearchValue(oleReader);
                    break;
                }
            }catch (Exception e) {
                throw e;
            } finally {
                oleReader.Close();
                oleConn.Close();
                File.Delete(HttpContext.Current.Server.MapPath(fileName));
            }
        }
示例#25
0
文件: AccessDB.cs 项目: cwdotson/FwNs
        public int SelectData(out string errMessage)
        {
            int num = 0;

            errMessage = null;
            OleDbConnection connection = null;
            OleDbDataReader reader     = null;

            try
            {
                connection = new OleDbConnection {
                    ConnectionString = this.connectionString
                };
                connection.Open();
                string str = "SELECT * FROM DBINFO";
                reader = new OleDbCommand {
                    Connection  = connection,
                    CommandText = str
                }.ExecuteReader();
                while (reader.Read())
                {
                    num++;
                }
            }
            catch (Exception exception)
            {
                errMessage = "errMessage:" + exception.Message + string.Format("\r\n\r\nMethod Name : SelectData", new object[0]);
                num        = -1;
            }
            finally
            {
                reader.Close();
                reader.Dispose();
                connection.Close();
                connection.Dispose();
            }
            return(num);
        }
示例#26
0
 private void metroButton1_Click(object sender, EventArgs e)
 {
     if (!String.IsNullOrEmpty(textBox1.Text) && !String.IsNullOrEmpty(textBox2.Text))
     {
         OleDbConnection connection = new OleDbConnection(@"Provider = Microsoft.Jet.OLEDB.4.0; Data Source = ..\..\БДDeeplay.mdb");
         connection.Open();
         OleDbDataReader reader = new OleDbCommand("SELECT Пользователи.Код FROM Пользователи WHERE " +
                                                   $"Пользователи.Логин='{textBox1.Text}' AND Пользователи.Пароль='{textBox2.Text}'", connection).ExecuteReader();
         if (reader.HasRows)
         {
             Hide();
             Form2 form2 = new Form2();
             form2.ShowDialog();
             Close();
         }
         else
         {
             MessageBox.Show("Ошибка");
         }
         reader.Close();
         connection.Close();
     }
 }
        public void RefreshDataGridView()
        {
            OleDbConnection connection = null;
            OleDbDataReader dataReader = null;

            try
            {
                this.userIDStrList.Clear();
                this.dataGridView1.Rows.Clear();
                this.btnDelRecord.Visible = false;
                int inum = 0;
                try
                {
                    connection = new OleDbConnection();
                    connection.ConnectionString = this.gLineTestProcessor.mddbPathStr;
                    connection.Open();
                    dataReader = new OleDbCommand("select * from THistoryDataInfo ORDER BY ID DESC", connection).ExecuteReader();
                    this.dataGridView1.AllowUserToAddRows = true;
                    while (dataReader.Read())
                    {
                        this.dataGridView1.Rows.Add(1);
                        int num = inum + 1;
                        this.dataGridView1.Rows[inum].Cells[0].Value = System.Convert.ToString(num);
                        this.strIDArray[inum] = dataReader["ID"].ToString();
                        this.dataGridView1.Rows[inum].Cells[1].Value = dataReader["ProjectName"].ToString();
                        this.dataGridView1.Rows[inum].Cells[3].Value = dataReader["batchMumberStr"].ToString();
                        this.dataGridView1.Rows[inum].Cells[2].Value = dataReader["bcCableName"].ToString();
                        this.dataGridView1.Rows[inum].Cells[4].Value = dataReader["TestTime"].ToString();
                        this.userIDStrList.Add(dataReader["Tester"].ToString());
                        this.dataGridView1.Rows[inum].Cells[5].Value = dataReader["Operator"].ToString();
                        this.dataGridView1.Rows[inum].Cells[6].Value = dataReader["TestResult"].ToString();
                        inum = num;
                        if (inum >= 5000)
                        {
                            break;
                        }
                    }
                    this.dataGridView1.AllowUserToAddRows = false;
                    dataReader.Close();
                    dataReader = null;
                    connection.Close();
                    connection = null;
                }
                catch (System.Exception arg_241_0)
                {
                    this.dataGridView1.AllowUserToAddRows = false;
                    KLineTestProcessor.ExceptionRecordFunc(arg_241_0.StackTrace);
                    if (dataReader != null)
                    {
                        dataReader.Close();
                        dataReader = null;
                    }
                    if (connection != null)
                    {
                        connection.Close();
                        connection = null;
                    }
                }
            }
            catch (System.Exception arg_265_0)
            {
                KLineTestProcessor.ExceptionRecordFunc(arg_265_0.StackTrace);
            }
        }
示例#28
0
        public void RefreshDataGridView()
        {
            OleDbConnection connection = null;
            OleDbDataReader dataReader = null;

            try
            {
                this.dataGridView1.Rows.Clear();
                int iUserCount = 0;
                try
                {
                    connection = new OleDbConnection();
                    connection.ConnectionString = this.gLineTestProcessor.dbPathStr;
                    connection.Open();
                    dataReader = new OleDbCommand("select * from TUser where UEnabled=1 order by UID asc", connection).ExecuteReader();
                    while (dataReader.Read())
                    {
                        string tempStr = dataReader["UEID"].ToString();
                        this.userStrArray[iUserCount] = KLineTestProcessor.DecodeDisposeFunc(tempStr);
                        this.nameStrArray[iUserCount] = dataReader["UNAME"].ToString();
                        iUserCount++;
                        if (iUserCount >= FormUserManage.MAX_USER_NUM)
                        {
                            break;
                        }
                    }
                    dataReader.Close();
                    dataReader = null;
                    connection.Close();
                    connection = null;
                }
                catch (System.Exception ex)
                {
                    if (dataReader != null)
                    {
                        dataReader.Close();
                        dataReader = null;
                    }
                    if (connection != null)
                    {
                        connection.Close();
                        connection = null;
                    }
                    KLineTestProcessor.ExceptionRecordFunc(ex.StackTrace);
                    goto IL_19E;
                }
                if (iUserCount > 0)
                {
                    this.dataGridView1.AllowUserToAddRows = true;
                    int num;
                    for (int i = 0; i < iUserCount; i = num)
                    {
                        this.dataGridView1.Rows.Add(1);
                        num = i + 1;
                        this.dataGridView1.Rows[i].Cells[0].Value = System.Convert.ToString(num);
                        this.dataGridView1.Rows[i].Cells[1].Value = this.userStrArray[i];
                        this.dataGridView1.Rows[i].Cells[2].Value = this.nameStrArray[i];
                    }
                    this.dataGridView1.AllowUserToAddRows = false;
                }
                IL_19E :;
            }
            catch (System.Exception ex2)
            {
                this.dataGridView1.AllowUserToAddRows = false;
                KLineTestProcessor.ExceptionRecordFunc(ex2.StackTrace);
            }
        }
        private void btnQuery_Click(object sender, System.EventArgs e)
        {
            OleDbConnection connection = null;
            string          sqlcommand = null;
            OleDbDataReader dataReader = null;

            try
            {
                System.ValueType dt        = this.dateTimePicker_start.Value;
                System.ValueType dt2       = this.dateTimePicker_stop.Value;
                System.ValueType valueType = default(System.DateTime);
                (System.DateTime)valueType = new System.DateTime(((System.DateTime)dt).Year, ((System.DateTime)dt).Month, ((System.DateTime)dt).Day, 0, 0, 0, 0);
                System.ValueType startdt    = valueType;
                System.ValueType valueType2 = default(System.DateTime);
                (System.DateTime)valueType2 = new System.DateTime(((System.DateTime)dt2).Year, ((System.DateTime)dt2).Month, ((System.DateTime)dt2).Day, 23, 59, 59, 999);
                System.ValueType stopdt = valueType2;
                System.DateTime  value  = this.dateTimePicker_stop.Value;
                if (System.DateTime.Compare(this.dateTimePicker_start.Value, value) > 0)
                {
                    MessageBox.Show("起始日期大于终止日期!", "提示", MessageBoxButtons.OK);
                }
                else
                {
                    string _cablebhStr    = this.textBox_cableName.Text.ToString();
                    string batchMumberStr = this.textBox_batchMumber.Text.ToString().Trim();
                    this.userIDStrList.Clear();
                    this.dataGridView1.Rows.Clear();
                    this.btnDelRecord.Visible = false;
                    int inum = 0;
                    try
                    {
                        connection = new OleDbConnection();
                        connection.ConnectionString = this.gLineTestProcessor.mddbPathStr;
                        connection.Open();
                        if (string.IsNullOrEmpty(_cablebhStr) && string.IsNullOrEmpty(batchMumberStr))
                        {
                            sqlcommand = "select * from THistoryDataInfo where TestTime Between #" + valueType + "# and #" + valueType2 + "# ORDER BY ID DESC";
                        }
                        else if (!string.IsNullOrEmpty(_cablebhStr) && !string.IsNullOrEmpty(batchMumberStr))
                        {
                            sqlcommand = "select * from THistoryDataInfo where batchMumberStr = '" + batchMumberStr + "' and bcCableName = '" + _cablebhStr + "' and TestTime Between #" + valueType + "# and #" + valueType2 + "# ORDER BY ID DESC";
                        }
                        else if (string.IsNullOrEmpty(_cablebhStr) && !string.IsNullOrEmpty(batchMumberStr))
                        {
                            sqlcommand = "select * from THistoryDataInfo where batchMumberStr = '" + batchMumberStr + "' and TestTime Between #" + valueType + "# and #" + valueType2 + "# ORDER BY ID DESC";
                        }
                        else if (!string.IsNullOrEmpty(_cablebhStr) && string.IsNullOrEmpty(batchMumberStr))
                        {
                            sqlcommand = "select * from THistoryDataInfo where bcCableName = '" + _cablebhStr + "' and TestTime Between #" + valueType + "# and #" + valueType2 + "# ORDER BY ID DESC";
                        }
                        dataReader = new OleDbCommand(sqlcommand, connection).ExecuteReader();
                        this.dataGridView1.AllowUserToAddRows = true;
                        while (dataReader.Read())
                        {
                            this.dataGridView1.Rows.Add(1);
                            int num = inum + 1;
                            this.dataGridView1.Rows[inum].Cells[0].Value = System.Convert.ToString(num);
                            this.strIDArray[inum] = dataReader["ID"].ToString();
                            this.dataGridView1.Rows[inum].Cells[1].Value = dataReader["ProjectName"].ToString();
                            this.dataGridView1.Rows[inum].Cells[3].Value = dataReader["batchMumberStr"].ToString();
                            this.dataGridView1.Rows[inum].Cells[2].Value = dataReader["bcCableName"].ToString();
                            this.dataGridView1.Rows[inum].Cells[4].Value = dataReader["TestTime"].ToString();
                            this.userIDStrList.Add(dataReader["Tester"].ToString());
                            this.dataGridView1.Rows[inum].Cells[5].Value = dataReader["Operator"].ToString();
                            this.dataGridView1.Rows[inum].Cells[6].Value = dataReader["TestResult"].ToString();
                            inum = num;
                            if (inum >= 5000)
                            {
                                break;
                            }
                        }
                        this.dataGridView1.AllowUserToAddRows = false;
                        dataReader.Close();
                        dataReader = null;
                        connection.Close();
                        connection = null;
                        if (inum <= 0)
                        {
                            MessageBox.Show("查无记录!", "提示", MessageBoxButtons.OK);
                            return;
                        }
                    }
                    catch (System.Exception arg_4AE_0)
                    {
                        this.dataGridView1.AllowUserToAddRows = false;
                        KLineTestProcessor.ExceptionRecordFunc(arg_4AE_0.StackTrace);
                        if (dataReader != null)
                        {
                            dataReader.Close();
                            dataReader = null;
                        }
                        if (connection != null)
                        {
                            connection.Close();
                            connection = null;
                        }
                    }
                    this.qCablebhStr = _cablebhStr;
                    this.qStartdt    = startdt;
                    this.qStopdt     = stopdt;
                    this.qMethod     = 0;
                }
            }
            catch (System.Exception arg_4F0_0)
            {
                KLineTestProcessor.ExceptionRecordFunc(arg_4F0_0.StackTrace);
            }
        }
        public void GLDealwithFunc()
        {
            OleDbConnection connection = null;
            string          sqlcommand = null;
            OleDbDataReader dataReader = null;

            try
            {
                this.dataGridView1.Rows.Clear();
                int    inum     = 0;
                string cNameStr = this.textBox_Connector.Text.ToString().Trim();
                try
                {
                    connection = new OleDbConnection();
                    connection.ConnectionString = this.gLineTestProcessor.dbPathStr;
                    connection.Open();
                    if (this.comboBox_sxtj.SelectedIndex == 0)
                    {
                        if (string.IsNullOrEmpty(cNameStr))
                        {
                            sqlcommand = "select * from TConnectorLibrary order by ConnectorName";
                        }
                        else
                        {
                            sqlcommand = "select * from TConnectorLibrary where ConnectorName like '%" + cNameStr + "%' order by ConnectorName";
                        }
                    }
                    else if (this.comboBox_sxtj.SelectedIndex == 1)
                    {
                        if (string.IsNullOrEmpty(cNameStr))
                        {
                            sqlcommand = "select * from TConnectorLibrary order by ConverterType";
                        }
                        else
                        {
                            sqlcommand = "select * from TConnectorLibrary where ConverterType like '%" + cNameStr + "%' order by ConverterType";
                        }
                    }
                    else if (this.comboBox_sxtj.SelectedIndex == 2)
                    {
                        if (string.IsNullOrEmpty(cNameStr))
                        {
                            sqlcommand = "select * from TConnectorLibrary order by PinNum";
                        }
                        else
                        {
                            sqlcommand = "select * from TConnectorLibrary where PinNum='" + cNameStr + "'";
                        }
                    }
                    dataReader = new OleDbCommand(sqlcommand, connection).ExecuteReader();
                    this.dataGridView1.AllowUserToAddRows = true;
                    while (dataReader.Read())
                    {
                        this.dataGridView1.Rows.Add(1);
                        int num = inum + 1;
                        this.dataGridView1.Rows[inum].Cells[0].Value = System.Convert.ToString(num);
                        this.strIDArray[inum] = dataReader["ID"].ToString();
                        this.dataGridView1.Rows[inum].Cells[1].Value = dataReader["ConnectorName"].ToString();
                        this.dataGridView1.Rows[inum].Cells[2].Value = dataReader["ConverterType"].ToString();
                        this.dataGridView1.Rows[inum].Cells[3].Value = dataReader["PinNum"].ToString();
                        this.dataGridView1.Rows[inum].Cells[4].Value = dataReader["Remark"].ToString();
                        inum = num;
                        if (inum >= 5000)
                        {
                            break;
                        }
                    }
                    this.dataGridView1.AllowUserToAddRows = false;
                    dataReader.Close();
                    dataReader = null;
                    connection.Close();
                    connection = null;
                }
                catch (System.Exception arg_26D_0)
                {
                    this.dataGridView1.AllowUserToAddRows = false;
                    KLineTestProcessor.ExceptionRecordFunc(arg_26D_0.StackTrace);
                    if (dataReader != null)
                    {
                        dataReader.Close();
                        dataReader = null;
                    }
                    if (connection != null)
                    {
                        connection.Close();
                        connection = null;
                    }
                }
            }
            catch (System.Exception arg_291_0)
            {
                KLineTestProcessor.ExceptionRecordFunc(arg_291_0.StackTrace);
            }
        }