彻底疯了!看看,哪里错了?

tojike 2002-09-03 05:46:01
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 sln_1
{
/// <summary>
/// WebForm1 的摘要说明。
/// </summary>
public class WebForm1 : System.Web.UI.Page
{
protected System.Web.UI.WebControls.Label Label_userid;
protected System.Web.UI.WebControls.TextBox TextBox_userid;
protected System.Web.UI.WebControls.TextBox TextBox_old;
protected System.Web.UI.WebControls.TextBox TextBox_1newpass;
protected System.Web.UI.WebControls.TextBox TextBox_2newpass;
protected System.Web.UI.WebControls.Button Btn_ChangePass;
protected System.Web.UI.WebControls.Button Btn_Clear;
protected System.Web.UI.WebControls.Label Label_old;
protected System.Web.UI.WebControls.Label Label_1newpass;
protected System.Web.UI.WebControls.Label Label_message;
protected System.Web.UI.WebControls.Label Label_2newpass;



private void Page_Load(object sender, System.EventArgs e)
{
//Label_message.Visible=false;

// 在此处放置用户代码以初始化页面
}

#region Web Form Designer generated code
override protected void OnInit(EventArgs e)
{
//
// CODEGEN:该调用是 ASP.NET Web 窗体设计器所必需的。
//
InitializeComponent();
base.OnInit(e);
}

/// <summary>
/// 设计器支持所需的方法 - 不要使用代码编辑器修改
/// 此方法的内容。
/// </summary>
private void InitializeComponent()
{
this.Btn_ChangePass.Click += new System.EventHandler(this.Btn_ChangePass_Click);
this.Load += new System.EventHandler(this.Page_Load);

}
#endregion

private void Btn_ChangePass_Click(object sender, System.EventArgs e)
{
Label_message.Text="";
if(TextBox_userid.Text!="" && TextBox_old.Text!="" && TextBox_1newpass.Text!="" && TextBox_2newpass.Text!="")
{//yes
Label_message.Text="";

if(TextBox_1newpass.Text==TextBox_2newpass.Text)//新密码一致
{
//yes
Label_message.Text="";
OleDbConnection olecn=new OleDbConnection("Provider=MSDAORA.1;Password=orcl;user ID=orcl;Data Source=zb");
String Str1="Update XIANGZHEN_MMB set PASSWORD='"+TextBox_1newpass.Text+"' where USERNAME='"+TextBox_userid.Text+"'";
String Str="select * from XIANGZHEN_MMB where USERNAME='"+TextBox_userid.Text+"' and PASSWORD='"+TextBox_userid.Text+"'";
olecn.Open();
OleDbCommand cm=new OleDbCommand(Str,olecn);
cm.CommandTimeout=50;
OleDbDataReader dr=cm.ExecuteReader();
if(dr.Read())//用户名密码一致
{
Label_message.Text="";
dr.Close();
OleDbCommand cm1=new OleDbCommand(Str1,olecn);

cm1.CommandTimeout=50;
OleDbDataAdapter da=new OleDbDataAdapter();
da.SelectCommand=cm1;

DataSet ds=new DataSet();
da.Fill(ds,"XIANGZHEN_MMB");
olecn.Close();
}//执行数据库update操作
else
{//否则,提示用户名密码不对

Label_message.Text="对不起,用户名/密码不对,请重新输入!";
olecn.Close();
dr.Close();


}
Label_message.Text="注意:输入的两次新密码不一致,请重新输入!"; //no
}

Label_message.Text="注意:文本域中有空值,请检查并输入!";
}//no




}//Btn_ChangePass_Click

}//class
}//namespace


...全文
37 5 打赏 收藏 转发到动态 举报
写回复
用AI写文章
5 条回复
切换为时间正序
请发表友善的回复…
发表回复
ameng_2002 2002-09-07
  • 打赏
  • 举报
回复
是啊,贴出错误信息
sheyanfen 2002-09-07
  • 打赏
  • 举报
回复
贴出出错信息,这样比较容易找错误
wangj_me 2002-09-07
  • 打赏
  • 举报
回复
注意在oracle中使用dml语句一定别忘了后面加上commit;
实际上你应该把这些dml语句写在存储过程中,查询使用包,其中存储过程中还要加错误跟踪,成功了commit;否则rollback;

如果你不commit;数据并没有真正变化,这样接下来的操作会有问题的
tojike 2002-09-03
  • 打赏
  • 举报
回复
这句哪里错误了?请指示
spring_ok 2002-09-03
  • 打赏
  • 举报
回复
这一句
String Str="select * from XIANGZHEN_MMB where USERNAME='"+TextBox_userid.Text+"' and PASSWORD='"+TextBox_userid.Text+"'";

62,254

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术交流专区
javascript云原生 企业社区
社区管理员
  • ASP.NET
  • .Net开发者社区
  • R小R
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

.NET 社区是一个围绕开源 .NET 的开放、热情、创新、包容的技术社区。社区致力于为广大 .NET 爱好者提供一个良好的知识共享、协同互助的 .NET 技术交流环境。我们尊重不同意见,支持健康理性的辩论和互动,反对歧视和攻击。

希望和大家一起共同营造一个活跃、友好的社区氛围。

试试用AI创作助手写篇文章吧