locked
Datatable to String or Array? RRS feed

  • Question

  • User1225369314 posted

    Hi, have a JSON ajax request from my page like this:

            $(document).ready(function () {
                  
                $.ajax({
                    type: "POST",
                    url: "Helper.asmx/GetMyValues",
    ......


    In my Helper.vb code I've created a datatable from an MS Access Database table, the data in it looks like this:

    AreaName, AreaValue
    FR-J, 1.5
    FR-G, 2
    FR-S,1.5
    etc...

    from the datatable how could I create a string like this

    {"year2012":{"results":{"FR-J":1.5,"FR-G":2,"FR-S":1.5,"FR-Q":1.5,"FR-F":2,"FR-P":1,"FR-D":1,"FR-O":1,"FR-M":2,"FR-A":2,"FR-I":2,"FR-R":1,"FR-E":1,"FR-T":1,"FR-B":1,"FR-N":1,"FR-L":1,"FR-V":2,"FR-C":1,"FR-K":1,"FR-U":2,"FR-H":2,"FR-GP":1,"FR-MQ":1,"FR-GF":1,"FR-YT":2}}}

    To return my values back to the JSON request?

    Many thanks

    Saturday, July 6, 2013 4:04 AM

All replies