伺服器返回xml只需要加上 ![CDATA[ 既可以LE. using (SqlDataReader dr = SqlHelper.ExecuteReader(connstr, CommandType.Text, sql)) { while(dr.Read()) { xmlstr += ""; } }如果需要返回 json 呢 ? using (SqlDataReader dr = SqlHelper.ExecuteReader(connstr, CommandType.Text, sql)) { while (dr.Read()) { xmlstr += "{author:"" + dr.GetInt32(0) + "",title:"" + dr.GetString(1) + ""},"; } }======================我的 dr.GetString(1) 欄位裡面包含特殊字元:實在伺服器 端處理,還是 客戶端處理 ?insert into test2 values(1,"天山>寒雪")insert into test2 values(2,"天山""寒雪")insert into test2 values(3,"天山"寒雪")insert into test2 values(4,"天山
伺服器返回xml只需要加上 ![CDATA[ 既可以LE. using (SqlDataReader dr = SqlHelper.ExecuteReader(connstr, CommandType.Text, sql)) { while(dr.Read()) { xmlstr += ""; } }如果需要返回 json 呢 ? using (SqlDataReader dr = SqlHelper.ExecuteReader(connstr, CommandType.Text, sql)) { while (dr.Read()) { xmlstr += "{author:"" + dr.GetInt32(0) + "",title:"" + dr.GetString(1) + ""},"; } }======================我的 dr.GetString(1) 欄位裡面包含特殊字元:實在伺服器 端處理,還是 客戶端處理 ?insert into test2 values(1,"天山>寒雪")insert into test2 values(2,"天山""寒雪")insert into test2 values(3,"天山"寒雪")insert into test2 values(4,"天山