首页 > 代码库 > asp.net post方法;对象转json
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;
}
asp.net post方法;对象转json