主题:错误!
using System;
using System.Collections;
using System.ComponentModel;
using System.Data;
using System.Data.OleDb;
using System.Drawing;
using System.Web;
using System.Web.SessionState;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.HtmlControls;
namespace Aspnet
{
override protected void OnInit(EventArgs e)
{
//
// CODEGEN: 该调用是 ASP.NET Web 窗体设计器所必需的。
//
InitializeComponent();
base.OnInit(e);
}
/// <summary>
/// 设计器支持所需的方法 - 不要使用代码编辑器修改
/// 此方法的内容。
/// </summary>
private void InitializeComponent()
{
this.BT_submit.Click += new System.EventHandler(this.BT_submit_Click);
this.BT_cancel.Click += new System.EventHandler(this.BT_cancel_Click);
this.Load += new System.EventHandler(this.Page_Load);
}
#endregion
private void BT_cancel_Click(object sender, System.EventArgs e)
{
Response.Redirect("Index.aspx");
}
private void BT_submit_Click(object sender, System.EventArgs e)
{
string selectstr;
OleDbConnection Conn=new OleDbConnection
(@"provider=Microsoft.jet.oledb.4.0;data source=e:\Lgt\asp\Aspnet.mdb;");
if(RBL_type.SelectedItem.Value.ToString()=="普通用户")
{
selectstr="select count(*) from UserInfo where UserName like '"+TB_name.Text+"'and Pwd like '"+TB_pwd.Text+"'";}
else
{
selectstr="select count(*) from AdminInfo where AdminID like '"+TB_name.Text+"'and AdminPwd like '"+TB_pwd.Text+"'";
}
Session["type"]=RBL_type.SelectedItem.Value.ToString();
OleDbCommand mycommand=new OleDbCommand(selectstr,Conn);
Conn.Open();
int flag=(int)mycommand.ExecuteScalar();
Conn.Close();
if(flag>0)
{
Session["UserName"]=TB_name.Text;
Response.Redirect("ViewMessage.aspx");
}
else
{
Label1.Text="对不起,用户名和密码不符,请重新输入!";
TB_name.Text="";
TB_pwd.Text="";
}
}
}
}
执行以上代码时会出现这样的提示::
无法找到脚本库"/aspnet_client/system_web/1_1_4322/\\\\\\\\\WebUIValidation
.js".请尝试手动放置此文件,或通过运行"asnet_regiss-c"重新安装.
但程序仍可运行!!!
using System.Collections;
using System.ComponentModel;
using System.Data;
using System.Data.OleDb;
using System.Drawing;
using System.Web;
using System.Web.SessionState;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.HtmlControls;
namespace Aspnet
{
override protected void OnInit(EventArgs e)
{
//
// CODEGEN: 该调用是 ASP.NET Web 窗体设计器所必需的。
//
InitializeComponent();
base.OnInit(e);
}
/// <summary>
/// 设计器支持所需的方法 - 不要使用代码编辑器修改
/// 此方法的内容。
/// </summary>
private void InitializeComponent()
{
this.BT_submit.Click += new System.EventHandler(this.BT_submit_Click);
this.BT_cancel.Click += new System.EventHandler(this.BT_cancel_Click);
this.Load += new System.EventHandler(this.Page_Load);
}
#endregion
private void BT_cancel_Click(object sender, System.EventArgs e)
{
Response.Redirect("Index.aspx");
}
private void BT_submit_Click(object sender, System.EventArgs e)
{
string selectstr;
OleDbConnection Conn=new OleDbConnection
(@"provider=Microsoft.jet.oledb.4.0;data source=e:\Lgt\asp\Aspnet.mdb;");
if(RBL_type.SelectedItem.Value.ToString()=="普通用户")
{
selectstr="select count(*) from UserInfo where UserName like '"+TB_name.Text+"'and Pwd like '"+TB_pwd.Text+"'";}
else
{
selectstr="select count(*) from AdminInfo where AdminID like '"+TB_name.Text+"'and AdminPwd like '"+TB_pwd.Text+"'";
}
Session["type"]=RBL_type.SelectedItem.Value.ToString();
OleDbCommand mycommand=new OleDbCommand(selectstr,Conn);
Conn.Open();
int flag=(int)mycommand.ExecuteScalar();
Conn.Close();
if(flag>0)
{
Session["UserName"]=TB_name.Text;
Response.Redirect("ViewMessage.aspx");
}
else
{
Label1.Text="对不起,用户名和密码不符,请重新输入!";
TB_name.Text="";
TB_pwd.Text="";
}
}
}
}
执行以上代码时会出现这样的提示::
无法找到脚本库"/aspnet_client/system_web/1_1_4322/\\\\\\\\\WebUIValidation
.js".请尝试手动放置此文件,或通过运行"asnet_regiss-c"重新安装.
但程序仍可运行!!!