我在运行应用程序时每10秒自动刷新一次,下面突然出现错误

本文关键字:一次 错误 突然 应用程序 运行 10秒 刷新 | 更新日期: 2023-09-27 17:53:16

从接收结果时发生传输级别错误服务器(提供程序:会话提供程序,错误:19-物理连接不可用(

我正在使用实体框架,但我遇到了这个错误。我正在使用visual studio 2012(MVC(和SQL Server 2012

public JsonResult LineChart()
{
    List<AssetMigrationDetails> listDashBoard = new List<AssetMigrationDetails>();
    decimal sumTotal = 0;
    try
    {
          demoEntities2 objentity = new demoEntities2();
          var _objdBoard = (from data in objentity.tbl_dashboard
                               select new
                               {
                                   data.id
                               }).Count();
        sumTotal = Convert.ToDecimal(_objdBoard.ToString());
        var _objuserdetail = (from data in objentity.tbl_dashboard
                              where (data.isMigrated == "Y" && data.migrationdate <= System.DateTime.Now)
                              group data by EntityFunctions.TruncateTime(data.migrationdate) into k
                              select new
                              {
                                  date = k.Key,
                                  count = k.Count()
                              });
        foreach (var item in _objuserdetail)
        {
            AssetMigrationDetails objAsset = new AssetMigrationDetails();
            objAsset.Completion = (Convert.ToDecimal(item.count) / sumTotal) * 100;
            listDashBoard.Add(objAsset);
        }
        decimal sum = 0;
        decimal sum1 = 0;
        for (var i = 0; i < listDashBoard.Count(); i++)
        {
            sum = sum + Convert.ToDecimal(listDashBoard[i].Completion);
            sum1 = decimal.Parse(sum.ToString("0.00"));
            listDashBoard[i].Completion = sum1;
        }
        }
        catch (Exception ex)
        {
            var msg=ex.Message;
        }
        return Json(listDashBoard, JsonRequestBehavior.AllowGet);
 }

我在运行应用程序时每10秒自动刷新一次,下面突然出现错误

将Jquery替换为自动刷新

 $(document).ready(
              function () {
                  setInterval(function () {
                      $(".status").change();
                  }, 10000);
              });

您可以使用您的类名或id名称

来代替.status
相关文章: