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


C# DataType.UseQuotes方法代码示例

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


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

示例1: Query_FormatDetail

        public string Query_FormatDetail(ReportingSubject.Detail detail, string selection, ref string language)
        {
            string q = ""; // pad a space?
            string[] selections;
            string selectionlang;
            DataType datatype = new DataType();
            switch (detail.lang)
            {
                case "equals":
                case "IS":
                    selectionlang = selection;
                    if (detail.type == "bit")
                    {
                        if (selection == "1") { selectionlang = "True"; } else { selectionlang = "False"; }
                    }
                    if (datatype.UseQuotes(detail.type))
                    {// use quotes
                        q = detail.db + "='" + selection + "' AND ";
                        language = " Where '" + detail.name + "' is: '" + selectionlang + "' <br/>";
                    }
                    else
                    { // no quotes
                        q = detail.db + "=" + selection + " AND ";
                        language = " Where '" + detail.name + "' is: " + selectionlang + " <br/>";
                    }
                    break;
                case "IS ONE OF":
                case "IS IN":
                    // convert the comma delimited list of values into an array and parse
                    selections = selection.Split(new char[] { ',' });
                    q = detail.db + " IN (";
                    foreach (string specificdetail in selections)
                    {
                        if (datatype.UseQuotes(detail.type))
                        {// use quotes
                            q = q +"'" +specificdetail + "',";
                        }
                        else
                        { // no quotes
                            q = q + specificdetail + ",";
                        }
                    }
                    q = q.Remove(q.Length - 1); // remove last comma
                    q = q + ") AND ";
                    language = " Where '" + detail.name + "' is one of: '" + selection + "' <br/>";
                    break;
                case "IS BETWEEN":
                    selections = selection.Split(new char[] { ',' });
                    if (datatype.UseQuotes(detail.type))
                    {// use quotes
                        q = detail.db + ">='" + selections[0] + "' AND " + detail.db + "<='" + selections[1]+"'";
                    }
                    else
                    { // no quotes
                        q = detail.db + ">=" + selections[0] + " AND " + detail.db + "<=" + selections[1];
                    }
                    language = " Where '" + detail.name + "' is between: '" + selections[0] + " and " + selections[1] + "' <br/>";
                    break;
                case "IS BEFORE":
                    if (datatype.UseQuotes(detail.type))
                    {// use quotes
                        q = detail.db + "<'" + selection + "' AND ";
                        language = " Where '" + detail.name + "' is before: '" + selection + "' <br/>";
                    }
                    else
                    { // no quotes
                        q = detail.db + "<" + selection + " AND ";
                        language = " Where '" + detail.name + "' is after: " + selection + " <br/>";
                    }
                    break;
                case "IS AFTER":
                    if (datatype.UseQuotes(detail.type))
                    {// use quotes
                        q = detail.db + ">'" + selection + "' AND ";
                        language = " Where '" + detail.name + "' is before: '" + selection + "' <br/>";
                    }
                    else
                    { // no quotes
                        q = detail.db + ">" + selection + " AND ";
                        language = " Where '" + detail.name + "' is after: " + selection + " <br/>";
                    }
                    break;

            }
            return q;
        }
开发者ID:jmptrader,项目名称:UIFS,代码行数:86,代码来源:UIFS.Reporting.cs


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