Public Function GetJson(ByVal dt As DataTable) As String Dim serializer As System.Web.Script.Serialization.JavaScriptSerializer = New System.Web.Script.Serialization.JavaScriptSerializer() Dim rows As New List(Of Dictionary(Of String, Object)) Dim row As Dictionary(Of String, Object) Try For Each dr As DataRow In dt.Rows row = New Dictionary(Of String, Object) For Each col As DataColumn In dt.Columns row.Add(col.ColumnName, dr(col)) Next rows.Add(row) Next Return serializer.Serialize(rows) Catch ex As Exception logFile("SP GetJson ----" + ex.Message) Return "-1" End Try End Function
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)