当前位置:Gxlcms >
数据库问题 >
When using SqlDependency without providing an options value, SqlDependency.Start() must be called prior to execution of a command added to the SqlDependency instance.
When using SqlDependency without providing an options value, SqlDependency.Start() must be called prior to execution of a command added to the SqlDependency instance.
时间:2021-07-01 10:21:17
帮助过:2人阅读
System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using System.Web.Routing;
using Insus.NET.DataBases;
using System.Data.SqlClient;
namespace Insus.NET
{
public class MvcApplication : System.Web.HttpApplication
{
protected void Application_Start()
{
AreaRegistration.RegisterAllAreas();
RouteConfig.RegisterRoutes(RouteTable.Routes);
SqlDependency.Start(DB.ConnectionString);
}
protected void Application_End()
{
SqlDependency.Stop(DB.ConnectionString);
}
}
}
Source Code
When using SqlDependency without providing an options value, SqlDependency.Start() must be called prior to execution of a command added to the SqlDependency instance.
标签: