求助VS#2005问题
vc吧
全部回复
仅看楼主
level 4
占目之魂 楼主
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.Data.SqlClient;
using Base;
namespace 生产物流
{
     public partial class Frm_修改密码 : Form
     {
       
         public Frm_修改密码()
         {
             InitializeComponent();
         }
         private void Frm_修改密码_Load(object sender, EventArgs e)
         {
           
         }
         private void button1_Click(object sender, EventArgs e)
         {
             if (textBox1.Text.Trim() == "" || textBox2.Text == "" || textBox3.Text.Trim() == "" || textBox4.Text.Trim() == "")
             {
                 if (MessageBox.Show("请填写完整信息!", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
                 {
                     this.Close();
                 }
                 if (!(this.textBox2.Text.Trim() == this.textBox3.Text.Trim()) || (this.textBox4.Text.Trim().Length == 0))
              
                 {
                     MessageBox.Show("两次密码的输入不一致!", "信息提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                     return;
                 }
                
                 String ConnString = "Data Source=.;Initial Catalog=shchwl;Integrated Security=True";

2010年12月28日 14点12分 1
level 4
占目之魂 楼主
                 SqlConnection conn = new SqlConnection(ConnString);
                 DataTable dt = new DataTable();
                 string SQL = "select * from 用户表 where 登录名=登录名 and 口令=" + textBox2.Text.Trim();
                
                
                 SQL = "Update 用户表 Set 口令='" + this.textBox3.Text.Trim() + "' Where 登录名='" + this.textBox1.Text.Trim() + "'and 口令'" + this.textBox2.Text.Trim() + "'";
                 SqlConnection MyConnection = new SqlConnection(SQL);
                 SqlCommand MyCommand = new SqlCommand(SQL, MyConnection);
                 MyCommand.Connection.Open();
                 int MyCount = MyCommand.ExecuteNonQuery();
                 if (MyCount == 1)
                 {
                     MessageBox.Show("在数据库中修改用户密码操作成功!", "信息提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                 }
                 else
                 {
                     MessageBox.Show("在数据库中修改用户密码操作失败!", "信息提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                 }
                 if (MyConnection.State == ConnectionState.Open)
                 {
                     MyConnection.Close();
                 }
             }
         }
         private void button2_Click(object sender, EventArgs e)
         {
             this.Close();
         }
     }
}
这个是本人写的一个系统中用于修改的窗体按键,但是不知道为什么在修改密码时却无法使用,具体情况是把用户名,密码,新密码,确认密码都输入后按确定按钮没有反应,而没有全部输入完整时就按确定按钮,它就有提示。不知道这是什么原因?请各位大哥帮忙看下是什么问题。。。。在此先谢过。。。。

2010年12月28日 14点12分 2
1