本文整理汇总了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;
}
示例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;
}
示例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;
}
示例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;
}