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;
    }

posted @ 2014-10-22 09:34  qizhinan  阅读(1002)  评论(0编辑  收藏  举报