本文整理汇总了C#中Record.AddField方法的典型用法代码示例。如果您正苦于以下问题:C# Record.AddField方法的具体用法?C# Record.AddField怎么用?C# Record.AddField使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Record
的用法示例。
在下文中一共展示了Record.AddField方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ParseTemplate
//.........这里部分代码省略.........
(rec.Count - ((i - 1) * numTokens)).ToString()) + "\n");
pr.success = false;
return pr;
}
else start = ihold;
// Expected "for" token
if (tokens[i++].ToUpper() != "FOR")
{
pr.Error = (("Expected \"for\" on line " +
(rec.Count + 1).ToString() +
" field " +
(rec.Count - ((i - 1) * numTokens)).ToString()) + "\n");
pr.success = false;
return pr;
}
// Try to parse the size
if (!int.TryParse(tokens[i++], out ihold))
{
pr.Error = ((@"Unparsable Field Size on Line " +
(rec.Count + 1).ToString() +
" Field " +
(rec.Count - ((i - 1) * numTokens)).ToString()) + "\n");
pr.success = false;
return pr;
}
size = ihold;
// Expected "type" token
if (tokens[i++].ToUpper() != "TYPE")
{
pr.Error = (("Expected \"type\" on line " +
(rec.Count + 1).ToString() +
" field " +
(rec.Count - ((i - 1) * numTokens)).ToString()) + "\n");
pr.success = false;
return pr;
}
// Get the type
type = tokens[i++];
if (type.ToUpper() == "DATE")
{
// counts the date formatter which follows date
// oracle's date format is incomprehensible to our parsers
// technically this should be hidden in the datefield object
// but it's too abstracted behind the field object to make it
// owrth it. besides this counts as a token
i++;
}
bool isNullable = false;
if (tokens.Length > i)
{
for (int j = 0; j < 3; j++)
{
if (tokens[i].ToUpper() == "SUB_IND")
{
isTemplateIndicator = true;
i++;
}
// Optional Null paramter
if (tokens[i] == "NULL")
{
isNullable = true;
i++;
}
if (tokens[i] == "NOTNULL")
{
isNullable = false;
i++;
}
}
}
// We have our parameters add our new field
newField = rec.AddField(name, start, type, size, isTemplateIndicator, isNullable);
if (tokens.Length > i + 1)
{
if (tokens[i].ToUpper() == "SUB")
{
i++; // Count the "SUB" token
rec.NewSubTemplate(tokens[i++]); // start a new template & count the token
} // Check for optional rownumber extra bit
}
if (tokens.Length > i + 2)
{
if (tokens[i] == "Number" && tokens[i + 1] == "of" && tokens[i + 2] == "Rows:")
{
i += 3;
}
}
}
pr.record = rec;
pr.success = true;
// We've made our template
return pr;
}