📄 examlist.ascx.cs
字号:
using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Data.SqlClient;
using System.IO;
public partial class UserControl_examlist : System.Web.UI.UserControl
{
//该源码下载自www.51aspx.com(51aspx.com)
protected void Page_Load(object sender, EventArgs e)
{
string strcon = "";
if (strcon == "")
{
if (HttpContext.Current.Application["strcon"] == null)
{
string path = HttpContext.Current.Request.PhysicalApplicationPath + "DBSet.ini";//获取文件物理路径
StreamReader sr = new StreamReader(path, System.Text.Encoding.Default);
strcon = sr.ReadLine();//读取文件内容
}
else
{
strcon = HttpContext.Current.Application["strcon"].ToString();
}
}
SqlConnection con = new SqlConnection(strcon);
string strcmd = "select top 5 paper_name as 试卷情况,paper_styles as 试卷类型,paper_time as 考试时间 from testpaper_list where paper_time > @dtNow and test=1 and audit=1 order by paper_time asc ";
SqlCommand cmd = new SqlCommand(strcmd, con);
cmd.Parameters.Add("@dtNow", SqlDbType.DateTime).Value = (new ExamOnline.Login()).dsDelay(30);
con.Open();
SqlDataReader dr = cmd.ExecuteReader();
GridView1.DataSource = dr;
GridView1.DataBind();
dr.Close();
con.Close();
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -