2014-10-07 20 views

回答

0
public string DataRowToJSON(System.Data.DataRow row) 
    { 
     System.Collections.Generic.List<string> Fields = new System.Collections.Generic.List<string>(); 
     foreach (System.Data.DataColumn item in row.Table.Columns) Fields.Add(string.Format("\"{0}\":\"{1}\"", item.ColumnName, row[item].ToString())); 
     return string.Format("{{{0}}}", string.Join(",", Fields)); 
    } 

我不是完全地理解你在結果字符串報價多少需要...

+0

謝謝,我會嘗試在早上(只需在這裏下午5點後) – 2014-10-07 04:03:20