某一天发现web api的接口返回的json字符串(string格式)中,有多余的双引号,百度之后修改OK,代码如下:
public HttpResponseMessage get()
{
//建立连接对象
SqlConnection cnn = new SqlConnection();
cnn.ConnectionString = "Initial Catalog=TEST;Data Source=10.0x.5x.2x;User ID=xxxx;Password=xxx;";
//打开连接
cnn.Open();
string sql = "select khqc,dz from tbl_kh2";
//建立执行对象
SqlCommand cmd = new SqlCommand(sql, cnn);
DataSet ds = new DataSet();
SqlDataReader dr = cmd.ExecuteReader();
ArrayList clients = new ArrayList();
while(dr.Read())
{
Client client = new Client();
client.nm = dr["khqc"].ToString();
client.ad = dr["dz"].ToString();
//client.