/// <summary>
        /// 增加协议标识字典
        /// AccessPath、Ip、UserName、Pwd均为""时为本地默认路径数据库
        /// </summary>
        /// <param name="Items">增加的数据</param>
        /// <param name="AccessPath">本地数据库路径,填写此项则Ip、UserName、Pwd均填""</param>
        /// <param name="Ip">服务器Ip</param>
        /// <param name="UserName">登录名</param>
        /// <param name="Pwd">密码</param>
        public void InsertDict(List <DgnProtocolInfo> Items, string AccessPath, string Ip, string UserName, string Pwd)
        {
            List <string> _InsertDataBaseSQL = new List <string>();
            string        Sql = "";

            if (Items.Count < 1)
            {
                return;
            }
            for (int i = 0; i < Items.Count; i++)
            {
                DgnProtocolInfo Item = Items[i];
                Sql = string.Format("Insert into ProDLT645Dict (dltID,proNameNo,intIdentType,intClass,chrItemName,chrID,intLength,intDot,chrFormat,intType,chrDefValue) Values "
                                    + "({0},{1},{2},{3},'{4}','{5}',{6},{7},'{8}',{9},'{10}')", Item.Pd_dltID, Item.Pd_proNameNo, Item.Pd_intIdentType, Item.Pd_intClass, Item.Pd_chrItemName,
                                    Item.Pd_chrID, Item.Pd_intLength, Item.Pd_intDot, Item.Pd_chrFormat, Item.Pd_intType, Item.Pd_chrDefValue);
                _InsertDataBaseSQL.Add(Sql);
            }
            if (Ip != "")
            {
                InsertProDLT(_InsertDataBaseSQL, "", Ip, UserName, Pwd);
            }
            else if (AccessPath != "")
            {
                InsertProDLT(_InsertDataBaseSQL, AccessPath, "", "", "");
            }
            else
            {
                InsertProDLT(_InsertDataBaseSQL, "", "", "", "");
            }
        }
        /// <summary>
        /// 增加通讯协议
        /// AccessPath、Ip、UserName、Pwd均为""时为本地默认路径数据库
        /// </summary>
        /// <param name="Items"></param>
        /// <param name="AccessPath">本地数据库路径,填写此项则Ip、UserName、Pwd均填""</param>
        /// <param name="Ip">服务器Ip</param>
        /// <param name="UserName">登陆名</param>
        /// <param name="Pwd">密码</param>
        public void InsertProtoco(List <DgnProtocolInfo> Items, string AccessPath, string Ip, string UserName, string Pwd)
        {
            List <string> _InsertDataBaseSQL = new List <string>();
            string        Sql = "";

            if (Items.Count < 1)
            {
                return;
            }
            for (int i = 0; i < Items.Count; i++)
            {
                DgnProtocolInfo Item = Items[i];
                Sql = string.Format("Insert into ProtocolInfo (ProtocolID,proNameNo,chrPname,intInfoNo,chrValue) Values "
                                    + "({0},{1},'{2}',{3},'{4}')", Item.Pro_ProtocolID, Item.Pro_proNameNo, Item.Pro_chrPname, Item.Pro_intInfoNo, Item.Pro_chrValue);
                _InsertDataBaseSQL.Add(Sql);
            }
            if (Ip != "")
            {
                InsertProDLT(_InsertDataBaseSQL, "", Ip, UserName, Pwd);
            }
            else if (AccessPath != "")
            {
                InsertProDLT(_InsertDataBaseSQL, AccessPath, "", "", "");
            }
            else
            {
                InsertProDLT(_InsertDataBaseSQL, "", "", "", "");
            }
        }
        /// <summary>
        /// 查询协议标识字典
        /// </summary>
        /// <param name="sql">查询语句</param>
        /// <param name="AccessPath">Access数据库路径</param>
        /// <param name="Ip">服务器数据库Ip地址</param>
        /// <param name="UserName">服务器登录名</param>
        /// <param name="pwd">密码</param>
        /// <returns></returns>
        private DgnProtocolInfo GetProDLT645Dict(string sql, string AccessPath, string Ip, string UserName, string pwd)
        {
            DgnProtocolInfo Items = new DgnProtocolInfo();
            bool            flag  = false;

            if (Ip != "")
            {
                flag = ConnectDataBase("", Ip, UserName, pwd);
            }
            else if (AccessPath != "")
            {
                flag = ConnectDataBase(AccessPath, "", "", "");
            }
            else
            {
                flag = ConnectDataBase("", "", "", "");
            }

            try
            {
                if (!flag)
                {
                    return(Items);
                }
                System.Data.OleDb.OleDbCommand    Cmd    = new System.Data.OleDb.OleDbCommand(sql, _Data.Con);
                System.Data.OleDb.OleDbDataReader Reader = Cmd.ExecuteReader();
                while (Reader.Read())
                {
                    Items.Pd_dltID        = Convert.ToInt32(Reader["dltID"].ToString());        //编号
                    Items.Pd_proNameNo    = Convert.ToInt32(Reader["proNameNo"].ToString());    //国标协议代号
                    Items.Pd_intIdentType = Convert.ToInt32(Reader["intIdentType"].ToString()); //数据标识编码类型
                    Items.Pd_intClass     = Convert.ToInt32(Reader["intClass"].ToString());     //权限
                    Items.Pd_chrItemName  = Reader["chrItemName"].ToString();                   //项目名称
                    Items.Pd_chrID        = Reader["chrID"].ToString();                         //数据标识
                    Items.Pd_intLength    = Convert.ToInt32(Reader["intLength"].ToString());    //长度
                    Items.Pd_intDot       = Convert.ToInt32(Reader["intDot"].ToString());       //小数位
                    Items.Pd_chrFormat    = Reader["chrFormat"].ToString();                     //格式串
                    Items.Pd_intType      = Convert.ToInt32(Reader["intType"].ToString());      //操作方式
                    Items.Pd_chrDefValue  = Reader["chrDefValue"].ToString();                   //定义值
                }
                Reader.Close();
            }
            catch (Exception e)
            {
                System.Windows.Forms.MessageBox.Show(e.Message, "数据库操作错误", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Error);
            }
            finally
            {
                _Data.CloseDB();
            }
            return(Items);
        }
        /// <summary>
        /// 查询通讯协议
        /// </summary>
        /// <param name="sql">查询语句</param>
        /// <param name="AccessPath">Access数据库路径</param>
        /// <param name="Ip">服务器数据库Ip地址</param>
        /// <param name="UserName">服务器登录名</param>
        /// <param name="pwd">密码</param>
        /// <returns></returns>
        private DgnProtocolInfo GetProtocolInfo(string sql, string AccessPath, string Ip, string UserName, string pwd)
        {
            DgnProtocolInfo Items = new DgnProtocolInfo();
            bool            flag  = false;

            if (Ip != "")
            {
                flag = ConnectDataBase("", Ip, UserName, pwd);
            }
            else if (AccessPath != "")
            {
                flag = ConnectDataBase(AccessPath, "", "", "");
            }
            else
            {
                flag = ConnectDataBase("", "", "", "");
            }

            try
            {
                if (!flag)
                {
                    return(Items);
                }
                System.Data.OleDb.OleDbCommand    Cmd    = new System.Data.OleDb.OleDbCommand(sql, _Data.Con);
                System.Data.OleDb.OleDbDataReader Reader = Cmd.ExecuteReader();
                while (Reader.Read())
                {
                    Items.Pro_ProtocolID = Convert.ToInt32(Reader["ProtocolID"].ToString()); //协议编号
                    Items.Pro_proNameNo  = Convert.ToInt32(Reader["proNameNo"].ToString());  //通讯协议归属
                    Items.Pro_chrPname   = Reader["chrPname"].ToString();                    //协议名称
                    Items.Pro_intInfoNo  = Convert.ToInt32(Reader["intInfoNo"].ToString());  //信息序号
                    Items.Pro_chrValue   = Reader["chrValue"].ToString();                    //对应值
                }
                Reader.Close();
            }
            catch (Exception e)
            {
                System.Windows.Forms.MessageBox.Show(e.Message, "数据库操作错误", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Error);
            }
            finally
            {
                _Data.CloseDB();
            }
            return(Items);
        }
        /// <summary>
        /// 通讯协议修改
        /// AccessPath、Ip、UserName、Pwd均为""时为本地默认路径数据库
        /// </summary>
        /// <param name="Item">要修改的协议库数据</param>
        /// <param name="AccessPath">Access数据库路径,填写此项则Ip、UserName、pwd均填""</param>
        /// <param name="Ip">服务器数据库Ip地址</</param>
        /// <param name="UserName">服务器登录名</</param>
        /// <param name="Pwd">密码</param>
        public void UpdateProtocol(DgnProtocolInfo Item, string AccessPath, string Ip, string UserName, string Pwd)
        {
            string Sql = string.Format("Update ProtocolInfo Set ProtocolID={0},proNameNo={1},chrPname='{2}',intInfoNo={3},chrValue='{4}' where ProtocolID={5} AND proNameNo={6}",
                                       Item.Pro_ProtocolID, Item.Pro_proNameNo, Item.Pro_chrPname, Item.Pro_intInfoNo, Item.Pro_chrValue, Item.Pro_ProtocolID, Item.Pro_proNameNo);

            if (Ip != "")
            {
                UpdateProtocolInfo(Sql, "", Ip, UserName, Pwd);
            }
            else if (AccessPath != "")
            {
                UpdateProtocolInfo(Sql, AccessPath, "", "", "");
            }
            else
            {
                UpdateProtocolInfo(Sql, "", "", "", "");
            }
        }
        /// <summary>
        /// 协议标识字典修改
        /// AccessPath、Ip、UserName、Pwd均为""时为本地默认路径数据库
        /// </summary>
        /// <param name="Item">要修改的标识字典数据</param>
        /// <param name="AccessPath">Access数据库路径,填写此项则Ip、UserName、pwd均填""</param>
        /// <param name="Ip">服务器数据库Ip地址</param>
        /// <param name="UserName">服务器登录名</param>
        /// <param name="Pwd">密码</param>
        public void UpdateDict(DgnProtocolInfo Item, string AccessPath, string Ip, string UserName, string Pwd)
        {
            string Sql = string.Format("Update ProDLT645Dict Set dltID={0},proNameNo={1},intIdentType={2},intClass={3},chrItemName='{4}',chrID='{5}',intLength={6},intDot={7},chrFormat='{8}',intType={9},chrDefValue='{10}' where dltID={11} AND proNameNo={12}",
                                       Item.Pd_dltID, Item.Pd_proNameNo, Item.Pd_intIdentType, Item.Pd_intClass, Item.Pd_chrItemName, Item.Pd_chrID,
                                       Item.Pd_intLength, Item.Pd_intDot, Item.Pd_chrFormat, Item.Pd_intType, Item.Pd_chrDefValue, Item.Pd_dltID, Item.Pd_proNameNo);

            if (Ip != "")
            {
                UpdateProtocolInfo(Sql, "", Ip, UserName, Pwd);
            }
            else if (AccessPath != "")
            {
                UpdateProtocolInfo(Sql, AccessPath, "", "", "");
            }
            else
            {
                UpdateProtocolInfo(Sql, "", "", "", "");
            }
        }