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


C# Record.AddField方法代码示例

本文整理汇总了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;
        }
开发者ID:TeamBrett,项目名称:FadePlus-Master,代码行数:101,代码来源:BigFadePlus.cs


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