在线时间:8:00-16:00
迪恩网络APP
随时随地掌握行业动态
扫描二维码
关注迪恩网络微信公众号
protected void Page_Load(object sender, EventArgs e) { //数据库+Json MyJson.JsonNode_Object json = new MyJson.JsonNode_Object(); using (MySqlConnection myconn = dbhelper.Instance().getMySqlCon()) { MySqlCommand mySqlCommand = dbhelper.Instance().getSqlCommand("select * from gangshan", myconn); myconn.Open(); MySqlDataReader reader = mySqlCommand.ExecuteReader(); json.asDict()["nameList"] = new MyJson.JsonNode_Array(); while (reader.Read()) { if (reader.HasRows) { MyJson.JsonNode_Object rowsJson = new MyJson.JsonNode_Object(); rowsJson.asDict()["name"] = new MyJson.JsonNode_ValueString(reader["name"].ToString()); rowsJson.asDict()["id"] = new MyJson.JsonNode_ValueString(reader["id"].ToString()); rowsJson.asDict()["sex"] = new MyJson.JsonNode_ValueString(reader["sex"].ToString()); rowsJson.asDict()["age"] = new MyJson.JsonNode_ValueString(reader["age"].ToString()); json.asDict()["nameList"].AsList().Add(rowsJson); } } reader.Close(); myconn.Close(); } json.asDict()["state"] = new MyJson.JsonNode_ValueNumber(1); Response.Write(json.ToString()); }
|
2023-10-27
2022-08-15
2022-08-17
2022-09-23
2022-08-13
请发表评论