using System;
using System.Collections;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Web;
using System.Web.SessionState;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.HtmlControls;
using System.Data.OleDb;namespace gongshu
{
/// <summary>
/// Login 的摘要说明。
/// </summary>
public class Login : System.Web.UI.Page
{
protected System.Web.UI.WebControls.TextBox TB_No;
protected System.Web.UI.WebControls.Button BT_Submit;
protected System.Web.UI.WebControls.Button BT_Cancel;
protected System.Web.UI.WebControls.TextBox TB_Pass;
private void Page_Load(object sender, System.EventArgs e)
{
Response.Write("fsdjgfusdgf");
// 在此处放置用户代码以初始化页面
} #region Web 窗体设计器生成的代码
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.Load += new System.EventHandler(this.Page_Load); }
#endregion private void BT_Submit_Click(object sender, System.EventArgs e)
{
Page.Response.Write("fsdjgfusdgf");
string strconn="Provider=Microsoft.Jet.OLEDB.4.0;Data Source="+Server.MapPath("./")+"table.mdb";
OleDbConnection conn=new OleDbConnection(strconn);
// OleDbConnection conn=new OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source="+Server.MapPath("./")+"table.mdb;");
string selectstr="select No from Use where No='"+TB_No.Text+"' and Password='"+TB_Pass.Text+"'";
OleDbCommand mycommand=new OleDbCommand(selectstr,conn);
Page.Response.Write(selectstr);
OleDbDataReader dr;
conn.Open();
TB_No.Text="123";
dr=mycommand.ExecuteReader();
while(dr.Read())
{
Session["No"]=TB_No.Text;
Response.Redirect("Aframe.htm");
}
TB_No.Text="123";
TB_Pass.Text="";
}
}
}
using System.Collections;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Web;
using System.Web.SessionState;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.HtmlControls;
using System.Data.OleDb;namespace gongshu
{
/// <summary>
/// Login 的摘要说明。
/// </summary>
public class Login : System.Web.UI.Page
{
protected System.Web.UI.WebControls.TextBox TB_No;
protected System.Web.UI.WebControls.Button BT_Submit;
protected System.Web.UI.WebControls.Button BT_Cancel;
protected System.Web.UI.WebControls.TextBox TB_Pass;
private void Page_Load(object sender, System.EventArgs e)
{
Response.Write("fsdjgfusdgf");
// 在此处放置用户代码以初始化页面
} #region Web 窗体设计器生成的代码
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.Load += new System.EventHandler(this.Page_Load); }
#endregion private void BT_Submit_Click(object sender, System.EventArgs e)
{
Page.Response.Write("fsdjgfusdgf");
string strconn="Provider=Microsoft.Jet.OLEDB.4.0;Data Source="+Server.MapPath("./")+"table.mdb";
OleDbConnection conn=new OleDbConnection(strconn);
// OleDbConnection conn=new OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source="+Server.MapPath("./")+"table.mdb;");
string selectstr="select No from Use where No='"+TB_No.Text+"' and Password='"+TB_Pass.Text+"'";
OleDbCommand mycommand=new OleDbCommand(selectstr,conn);
Page.Response.Write(selectstr);
OleDbDataReader dr;
conn.Open();
TB_No.Text="123";
dr=mycommand.ExecuteReader();
while(dr.Read())
{
Session["No"]=TB_No.Text;
Response.Redirect("Aframe.htm");
}
TB_No.Text="123";
TB_Pass.Text="";
}
}
}
解决方案 »
- WEB打印16K,要怎么设置WEB页面,假如用层来实现,层要多宽才合适呢?
- 请教一个问题
- objectdatasource中的select方法,怎样才能强制触发
- 大家帮我看看这段代码中的btnRemark_Server事件有什么问题
- 特殊字符如何进行url编码?
- 有哪位高手可以解决gridview中编辑之后更新时弹出提示对话框的功能?
- 如何实现注册时自动检测用户名是否存在这种效果,用AJAX Extensions!
- 创建母板页,呈现控件时出错-ContentPlaceHolder1
- Sql语句及DataGrid绑定
- 请问如何将两个数据源同时绑定?
- 急,在线等!1
- 有谁在web中用过dsoframer.ocx?
下次贴代码,记得将aspx文件也传上来。
我试过,
找不到文件 'E:\Inetpub\Inetpub_Gb\wwwroot\DataGridStudy\table.mdb'。
说明: 执行当前 Web 请求期间,出现未处理的异常。请检查堆栈跟踪信息,以了解有关该错误以及代码中导致错误的出处的详细信息。 异常详细信息: System.Data.OleDb.OleDbException: 找不到文件 'E:\Inetpub\Inetpub_Gb\wwwroot\DataGridStudy\table.mdb'。源错误:
行 63:
行 64: OleDbDataReader dr;
行 65: conn.Open();
行 66: TB_No.Text="123";
行 67: dr=mycommand.ExecuteReader();
在conn.Open();这一行出错,因为没有table.mdb这个文件
this.BT_Submit.Click += new System.EventHandler(this.BT_Submit_Click);
添加到private void InitializeComponent()里
时间也没有丢失。
只能看看你的.aspx文件
<%@ Page %>里面有没有AutoEventWireup="True" 有的话改成 AutoEventWireup="False"
如果还是不行,你把代码都贴出来。前后台的代码。