资源简介
最新ASP.NET在线考试系统
源码(附论文)
最新ASP.NET在线考试系统
最新ASP.NET在线考试系统
代码片段和文件信息
using System;
using System.Data;
using System.Configuration;
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.OleDb;
public partial class _Default : System.Web.UI.Page
{
protected void Page_Load(object sender EventArgs e)
{
}
protected void testlogbtn_Click(object sender EventArgs e)
{
string username = usernametxt.Text.Trim();
string password = pawtxt.Text.Trim();
string connecionstring =(string)Application[“connectstring“];
OleDbConnection conn = new OleDbConnection(connecionstring);
try
{
bool flag=false;
conn.Open();
string commandtext = “select distinct * from student where studentname=‘“ + username + “‘ and paw=‘“ + password + “‘“;
OleDbCommand checkcommand = new OleDbCommand(commandtext conn);
OleDbDataReader dr = checkcommand.ExecuteReader();
flag = dr.HasRows;
if (flag)
{
Session.Add(“username“ username);
Session.Add(“logintime“ System.DateTime.Now.ToLongTimeString());
conn.Close();
Response.Redirect(“test.aspx“);
}
else
{
lblmessage.Text = “用户名或密码错误,请重新登陆!“;
usernametxt.Text = ““;
pawtxt.Text = ““;
}
}
catch (Exception err)
{
Response.Write(err.Message);
//Response.Redirect(“error.aspx“);
}
finally
{
if (conn.State == ConnectionState.Open)
conn.Close();
}
}
protected void adminlogbtn_Click(object sender EventArgs e)
{
string username = usernametxt.Text.Trim();
string password = pawtxt.Text.Trim();
string connecionstring = (string)Application[“connectstring“];
OleDbConnection conn = new OleDbConnection(connecionstring);
try
{
bool flag = false;
conn.Open();
string commandtext = “select distinct * from admin where name=‘“ + username + “‘ and password=‘“ + password + “‘“;
OleDbCommand checkcommand = new OleDbCommand(commandtext conn);
OleDbDataReader dr = checkcommand.ExecuteReader();
flag = dr.HasRows;
if (flag)
{
Session.Add(“username“ username);
Session.Add(“logintime“ System.DateTime.Now.ToLongTimeString());
Session.Add(“role“ “adminstrator“);
conn.Close();
Response.Redirect(“guanli.aspx“);
}
else
{
lblmessage.Text = “用户名或密码错误,请重新登陆!“;
usernametxt.Text = ““;
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
文件 815104 2008-05-20 14:03 accessOnlineTest\App_Data\databa
文件 62 2006-11-08 22:09 accessOnlineTest\css1.css
文件 2922 2008-05-20 14:06 accessOnlineTest\Default.aspx
文件 3401 2006-11-09 21:04 accessOnlineTest\Default.aspx.cs
文件 679 2006-11-08 21:50 accessOnlineTest\error.aspx
文件 530 2006-11-08 21:49 accessOnlineTest\error.aspx.cs
文件 4945 2007-07-18 09:38 accessOnlineTest\from.gif
文件 1152 2006-11-08 08:41 accessOnlineTest\Global.asax
文件 5840 2006-11-09 21:33 accessOnlineTest\guanli.aspx
文件 655 2006-11-09 21:19 accessOnlineTest\guanli.aspx.cs
文件 4945 2007-07-18 09:38 accessOnlineTest\image\from.gif
..A.SH. 5120 2008-06-27 10:17 accessOnlineTest\image\Thumbs.db
文件 14174 2006-11-07 16:53 accessOnlineTest\image\tittle.jpg
文件 4408 2006-11-09 20:46 accessOnlineTest\test.aspx
文件 5719 2008-05-20 14:02 accessOnlineTest\test.aspx.cs
文件 244 2006-11-08 08:42 accessOnlineTest\web.config
文件 438784 2008-05-20 14:00 accessOnlineTest\论文.doc
目录 0 2008-05-20 14:03 accessOnlineTest\App_Data
目录 0 2008-06-27 10:17 accessOnlineTest\image
目录 0 2008-06-27 10:17 accessOnlineTest
----------- --------- ---------- ----- ----
1308684 20
评论
共有 条评论