protected void Page_Load(object sender, EventArgs e)
{
IList list = new InfoSource_first_Manager().GetInfoSource_firstBySql();
System.Text.StringBuilder sb = new System.Text.StringBuilder();
for (int i = 0; i < list.Count; i++)
{
string json = "{" + string.Format("id:'{0}',name:'{1}'", list[i].Id, list[i].SourceFirstName) + "}";
sb.Append(json);
if (i != list.Count - 1)
sb.Append(",");
}
Response.Write("[" + sb.ToString() + "]");
}
GetBranchOne.aspx
本文详细介绍了如何使用C#编程语言通过新建InfoSource_first_Manager对象获取数据,并利用StringBuilder进行数据拼接,最终将JSON格式的数据通过Response.Write方法进行响应输出。

被折叠的 条评论
为什么被折叠?



