asp.net post方法;对象转json

[System.Web.Services.WebMethod()]
    public static string GetPoints(string userId)
    {
        string strResult = string.Empty;
        try
        {
            List<IIMS_RTLocation> IIMS_RTLocationS = null;
            DataTable dt = MyHelper.DBScriptHelper.GetDataTableBySQL3(string.Format("select * from IIMS_RTLocation where UserId in({0})", userId.TrimEnd(‘,‘)));
            IIMS_RTLocationS = DataTableToList<IIMS_RTLocation>(dt);
            System.Web.Script.Serialization.JavaScriptSerializer json = new System.Web.Script.Serialization.JavaScriptSerializer();
            strResult = json.Serialize(IIMS_RTLocationS);
        }
        catch (Exception ex)
        {
            LogCommon.ilogError.Error(ex);
        }
        return strResult;
    }

郑重声明:本站内容如果来自互联网及其他传播媒体,其版权均属原媒体及文章作者所有。转载目的在于传递更多信息及用于网络分享,并不代表本站赞同其观点和对其真实性负责,也不构成任何其他建议。