62,074
社区成员
发帖
与我相关
我的任务
分享
<script runat="server">
void Application_Start(object sender, EventArgs e)
{
System.Threading.Thread th = new System.Threading.Thread(new System.Threading.ThreadStart(SelectConnectionSql));
Application["IdeoClass_Thread"] = th;
th.Start();
}
void Application_End(object sender, EventArgs e)
{
System.Threading.Thread th = (System.Threading.Thread)Application["IdeoClass_Thread"];
th.Abort();
}
void Application_Error(object sender, EventArgs e)
{
// 在出现未处理的错误时运行的代码
try
{
System.Threading.Thread th = (System.Threading.Thread)Application["IdeoClass_Thread"];
th.Abort();
}
catch (Exception ex)
{
}
finally
{
}
}
public void SelectConnectionSql()//查看课堂是否有到期的
{
while (true)
{
ClassZkwh.Apply.Requisition re = new ClassZkwh.Apply.Requisition();
using (System.Data.SqlClient.SqlConnection con = new System.Data.SqlClient.SqlConnection(re.ConnString))
{
string sql = "select * from IdeoClass where EndTime<'" + DateTime.Now.ToLocalTime() + "' and EndTime>='" + DateTime.Now.AddMinutes(-1) + "'";
System.Data.SqlClient.SqlDataAdapter ad = new System.Data.SqlClient.SqlDataAdapter(sql, con);
System.Data.DataSet set = new System.Data.DataSet();
ad.Fill(set);
if (set.Tables.Count > 0)
{
System.Data.DataTable table = set.Tables[0];
if (table.Rows.Count > 0)
{
for (int i = 0; i < table.Rows.Count; i++)
{
ASPCOMLib.NetworkClass net = new ASPCOMLib.NetworkClass();
net.CloseMeeting = int.Parse(table.Rows[i][0].ToString());
}
}
}
}
System.Threading.Thread.Sleep(60000);
}
}
</script>