Home > Database > Mysql Tutorial > body text

LigerUi中下拉框一级树tree数据库读取代码示例!

WBOY
Release: 2016-06-07 15:41:21
Original
1346 people have browsed it

/// summary /// 格式化字符型、日期型、布尔型 /// /summary private static string StringFormat(string str, Type type) { if (type == typeof(string)) { str = String2Json(str); str = \ + str + \; } else if (type == typeof(DateTime)) { str = \ +

    /// <summary>
    /// 格式化字符型、日期型、布尔型
    /// </summary>

    private static string StringFormat(string str, Type type)
    {
        if (type == typeof(string))
        {
            str = String2Json(str);
            str = "\"" + str + "\"";
        }
        else if (type == typeof(DateTime))
        {
            str = "\"" + str + "\"";
        }
        else if (type == typeof(bool))
        {
            str = str.ToLower();
        }
        else if (type != typeof(string) && string.IsNullOrEmpty(str))
        {
            str = "\"" + str + "\"";
        }
        return str;
    }


    /// <summary>
    /// 过滤特殊字符
    /// </summary>
    private static string String2Json(String s)
    {
        StringBuilder sb = new StringBuilder();
        for (int i = 0; i 1 or Deleted is Null";

        Sql_Class SqlClass1 = new Sql_Class();
        SqlDataReader dr1 = SqlClass1.Sql_Select(Sql_Count);
        StringBuilder Count_1 = new StringBuilder();

        while (dr1.Read())
        {
            for (int i = 0; i 1 or Deleted is Null";
        Sql_Class SqlClass = new Sql_Class();

        SqlDataReader dr = SqlClass.Sql_Select(Sql);

        StringBuilder jsonString = new StringBuilder();

        jsonString.Append("{");   // 总括号 -- 开始


        jsonString.Append('"' + "Total" + '"' + ":" + '"' + Count_1.ToString() + '"' + ",");   // 字段总数

        jsonString.Append('"' + "Rows" + '"' + ":");   // 行字段开始

        jsonString.Append("[");   // 字段开始
        while (dr.Read())
        {
            jsonString.Append("{");
            for (int i = 0; i 

<p><br>
</p>
<p>[</p>
<p> {"id":"188","value":null,"text":"中国","icon": null, "fatherid": null, "children":null},</p>
<p> {"id":"20","value":null,"text":"河北","icon": null, "fatherid": null, "children":null},</p>
<p> {"id":"21","value":null,"text":"河南","icon": null, "fatherid": null, "children":null},</p>
<p> {"id":"11","value":null,"text":"河东","icon": null, "fatherid": null, "children":null},</p>
<p> {"id":"12","value":null,"text":"上海","icon": null, "fatherid": null, "children":null},</p>
<p> {"id":"166","value":null,"text":"北京","icon": null, "fatherid": null, "children":null},</p>
<p> {"id":"888","value":null,"text":"天津","icon": null, "fatherid": null, "children": null}</p>
<p>]</p>
<br>


Copy after login
Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template