zoukankan      html  css  js  c++  java
  • .net拼接json字符串

                        {
                            while (reader.Read())
                            {
                                if (reader.HasRows)
                                {
                                    JSONstring += "{";
                                    JSONstring += """ + "变量名" + "":"" + reader.GetString("变量") + "",";
                                    JSONstring += """ + "变量名" + "":"" + reader.GetString("变量") + "",";
                                    JSONstring += """ + "变量名" + "":"" + reader.GetString("变量") + "",";
                                    JSONstring += """ + "变量名" + "":"" + reader.GetString("变量") + "",";
                                    JSONstring += """ + "变量名" + "":"" + reader.GetString("变量") + "",";
                                    JSONstring += """ + "变量名" + "":"" + reader.GetString("变量") + "",";                                  
                                    JSONstring += """ + "detail" + """;
                                    JSONstring += ":";
                                    JSONstring += "[";
    
                                    MySqlDataReader reader = MysqlHelper.ExecuteReader(" SELECT* FROM table where 条件='条件'");//第二个查询写在这里,里面可以循环多个参数
                                    try
                                    {
                                        while (readerT.Read())
                                        {
    
                                            if (readerT.HasRows)
                                            {
                                                JSONstring += "{";
                                                JSONstring += """ + "变量名" + "":"" + reader.GetString("变量") + "",";
                                                JSONstring += """ + "变量名" + "":"" + reader.GetString("变量") + "",";
                                                JSONstring += """ + "变量名" + "":"" + reader.GetString("变量") + "",";   
                                                JSONstring += "},";
                                            }
                                        }
                                    }
                                    catch { readerT.Close(); }
                                    finally { readerT.Close(); }
                                    JSONstring = JSONstring.TrimEnd(specialChars);
                                    JSONstring += "]},";
                                    Log.Error(JSONstring, "请求JSONstring页面的JSONstring参数中的值");
                                }
                            }
                            JSONstring = JSONstring.TrimEnd(specialChars);
                            JSONstring += "]";
                        }
  • 相关阅读:
    虚拟机安装配置
    大整数加法 面试题
    结构体
    操作文件
    Gcd HDU
    牛客练习赛47 A DongDong破密码 (异或性质,递推)
    ACM常用之 异或运算的性质。
    Wannafly挑战赛22 C 多项式(大数,多项式极限)
    大数全能模板
    Wannafly挑战赛22 D 整数序列 (线段树维护三角函数值)
  • 原文地址:https://www.cnblogs.com/Gavin-Xp/p/10478096.html
Copyright © 2011-2022 走看看