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


C# Columns.ContainsKey方法代码示例

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


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

示例1: GetPrimaryKeys

        private Columns GetPrimaryKeys(int objectId, string connectionString, Columns columns)
        {
            StringBuilder sqlBuilder = new StringBuilder();
            sqlBuilder.Append("select syscolumns.name from syscolumns,sysobjects,sysindexes,sysindexkeys ");
            sqlBuilder.AppendFormat("where syscolumns.id ={0} ", objectId);
            sqlBuilder.Append("and sysobjects.xtype = 'PK' and sysobjects.parent_obj = syscolumns.id ");
            sqlBuilder.Append("and sysindexes.id = syscolumns.id and sysobjects.name = sysindexes.name and ");
            sqlBuilder.Append("sysindexkeys.id = syscolumns.id and sysindexkeys.indid = sysindexes.indid and syscolumns.colid = sysindexkeys.colid");

            Columns primaryKeys = new Columns(4);
            SqlDataReader dr = SqlHelper.ExecuteReader(connectionString, CommandType.Text, sqlBuilder.ToString());
            while (dr.Read())
            {
                string name = dr.IsDBNull(0) ? string.Empty : dr.GetString(0);
                if (columns.ContainsKey(name)) primaryKeys.Add(name, columns[name]);
            }
            dr.Close();

            return primaryKeys;
        }
开发者ID:xianrendzw,项目名称:CodeBuilder,代码行数:20,代码来源:SqlServer2005Exporter.cs

示例2: GetKeys

        private Columns GetKeys(XmlNode tableNode, Columns tableColumns)
        {
            XmlNode keysNode = tableNode["c:Keys"];
            if (keysNode == null ||
                keysNode.ChildNodes.Count == 0) return null;

            XmlNode keyColumnsNode = keysNode.ChildNodes[0]["c:Key.Columns"];
            if (keyColumnsNode == null ||
                keyColumnsNode.ChildNodes.Count == 0) return null;

            XmlNodeList keyColumnNodes = keyColumnsNode.ChildNodes;
            Columns keys = new Columns(keyColumnNodes.Count);
            foreach (XmlNode keyColumnNode in keyColumnNodes)
            {
                string id = keyColumnNode.Attributes["Ref"].InnerText;
                if (!tableColumns.ContainsKey(id)) continue;
                keys.Add(id, tableColumns[id]);
            }

            return keys;
        }
开发者ID:tavenli,项目名称:CodeBuilder,代码行数:21,代码来源:PowerDesigner12Exporter.cs

示例3: GetKeys

        private Dictionary<string, Columns> GetKeys(XmlNode tableNode, Columns tableColumns)
        {
            XmlNode keysNode = tableNode["c:Keys"];
            if (keysNode == null ||
                keysNode.ChildNodes.Count == 0) return null;

            Dictionary<string, Columns> keys = new Dictionary<string, Columns>(keysNode.ChildNodes.Count);
            foreach (XmlNode keyNode in keysNode.ChildNodes)
            {
                string keyId = keyNode.Attributes["Id"].InnerText;
                XmlNode keyColumnsNode = keyNode["c:Key.Columns"];
                if (keyColumnsNode == null ||
                    keyColumnsNode.ChildNodes.Count == 0) return null;

                Columns keyColumns = new Columns(keyColumnsNode.ChildNodes.Count);
                foreach (XmlNode keyColumnNode in keyColumnsNode.ChildNodes)
                {
                    string id = keyColumnNode.Attributes["Ref"].InnerText;
                    if (tableColumns.ContainsKey(id))
                        keyColumns.Add(id, tableColumns[id]);
                }

                keys.Add(keyId, keyColumns);
            }

            return keys;
        }
开发者ID:xianrendzw,项目名称:CodeBuilder,代码行数:27,代码来源:PowerDesigner12Exporter.cs

示例4: GetPrimaryKeys

        private Columns GetPrimaryKeys(XmlNode tableNode, Columns tableColumns)
        {
            XmlNode xmlNode = tableNode["c:PrimaryKey"];
            if (xmlNode == null ||
                xmlNode.ChildNodes.Count == 0) return null;

            XmlNodeList primaryKeyNodes = xmlNode.ChildNodes;
            Columns primaryKeys = new Columns(primaryKeyNodes.Count);
            foreach (XmlNode primaryKeyNode in primaryKeyNodes)
            {
                string id = primaryKeyNode.Attributes["Ref"].InnerText;
                if (!tableColumns.ContainsKey(id)) continue;
                primaryKeys.Add(id,tableColumns[id]);
            }

            return primaryKeys;
        }
开发者ID:tavenli,项目名称:CodeBuilder,代码行数:17,代码来源:PowerDesigner12Exporter.cs


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