完整页面代码如下:
<%@ Page Language="C#" Debug="true" %>
<%@ Import Namespace="System.Data" %>
<%@ Import Namespace="System.Data.OleDb" %>
<script runat="server">
void login_clikc(Object src,EventArgs e)
{
string conns = "Provider=Microsoft.Jet.OleDb.4.0;Data Source=" + Server.MapPath("data/otc2005.mdb"
;
string comms = "Select * From use Where bumen=\"" + bumen.SelectedItem.Text + "\" And mima=\"" + mima.Text + "\"";
OleDbConnection conn = new OleDbConnection(conns);
DataSet ds = new DataSet();
OleDbDataAdapter da = new OleDbDataAdapter(comms,conn);
da.Fill(ds,"user"
;
if(ds.Tables["user"].Rows.Count == 1)
{
Session["user"] = (ds.Tables["user"].Rows[0]["bumen"]).ToString();
Response.Redirect("System.aspx"
;
}
else
{
info.Text = "请输入正确的用户名及密码!";
}
}
</script>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>团队管理系统登录</title>
<link href="main.css" rel="stylesheet" type="text/css">
</head>
<body>
<div align="center" class="title">团队管理系统登录</div>
<form runat="server">
<table width="300" border="1" align="center" cellpadding="0" bordercolor="#A5007B" class="main">
<tr bordercolor="#FFFFFF">
<td width="79"> </td>
<td width="209"> </td>
</tr>
<tr bordercolor="#FFFFFF">
<td>用户名:</td>
<td><asp
ropDownList ID="bumen" runat="server" TabIndex="1">
<asp:ListItem >财务部</asp:ListItem>
<asp:ListItem >国内部</asp:ListItem>
<asp:ListItem >出境部</asp:ListItem>
<asp:ListItem >特种部</asp:ListItem>
</asp
ropDownList></td>
</tr>
<tr bordercolor="#FFFFFF">
<td>密码:</td>
<td><asp:TextBox ID="mima" runat="server" TextMode="Password" TabIndex="2" /></td>
</tr>
<tr bordercolor="#FFFFFF">
<td> </td>
<td> </td>
</tr>
<tr bordercolor="#FFFFFF">
<td><asp:Button ID="dl" Text="登录" runat="server" onClick="login_clikc" TabIndex="3"/></td>
<td><asp:Label ID="info" runat="server" /></td>
</tr>
</table>
</form>
</body>
</html>