日期:2014-05-17  浏览次数:20778 次

课程设计又遇到麻烦了,请各位老师给指点下,不胜感激!!!
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Data.SqlClient;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace 登录设计
{
    public partial class student : Form
    {
        public student()
        {
            InitializeComponent();
        }

        private void button3_Click(object sender, EventArgs e)
        {
            this.Close();
        }

        private void button2_Click(object sender, EventArgs e)
        {
            string cstr = @"Data Source=.;Initial Catalog=login;Integrated Security=True";
            string sql1 = string.Format("select *from login where Name='{0}'",textBox1.Text.Trim());
            string sql=string.Format("update login set Pwd='{0}' where Name={1}",textBox4.Text,textBox1.Text);
            using (SqlConnection conn = new SqlConnection(cstr))
            {
                using (SqlCommand cmd = new SqlCommand(sql1,conn))
                {
                    conn.Open();
                    using (SqlDataReader rd = cmd.ExecuteReader())
                    {
                        if (rd.Read())
                        {
                            if (rd.GetString(2) == textBox3.Text.Trim())
                                if (textBox4.Text == textBox5.Text)
                                {
      &nbs