第六次作业
| 成员姓名 | 学号后四位 | 贡献分 |
| 张雪(队长) | 1150 | 4 |
| 穆思羽 | 1172 | 2 |
| 毛蕊蕊 | 6015 | 2 |
| 赵瑞玲 | 1156 | 2 |
具体设计思路:
创建数据库,连接数据库,查询命令是根据输入的用户名查询出密码,当没有读出数据时表示’用户名不存在‘,当读出的密码与输入的密码不一致时表示
’密码错误,请重新输入‘,当读出的密码与输入密码一致时表示’祝贺你登录成功‘。
代码实现:
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Data.SqlClient;
namespace 登陆
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
SqlConnection conn = new SqlConnection("Data Source=LENOVO-PC\\DATA;AttachDbFilename=I:\\repair.mdf;Integrated Security=True");
string sql = "select passWord from user_info where userName='"+txtuser.Text+"'";
SqlCommand comm = new SqlCommand(sql, conn);
conn.Open();
SqlDataReader reader = comm.ExecuteReader();
if (!reader.Read())
{
label3.Visible = true;
label3.Text = "用户名不存在!";
}
else
{
if (reader["passWord"].ToString().Trim() == txtpwd.Text.Trim())
{
label3.Visible = true;
label3.Text = "祝贺你登录成功!";
}
else
{
label3.Visible = true;
label3.Text = "密码错误,请重新输入。";
}
}
reader.Close();
conn.Close();
}
}
}

测试:




PSP耗时分析:
| PSP | Personal Software Process Stages | Time(min) |
| Planning | 计划 | 20 |
| ·Estimate | ·估计这个任务需要多少时间 | 60 |
| Development | 开发 | 120 |
| ·Analysis | ·需求分析 | 20 |
| ·Design Spec | ·生成设计档案 | 20 |
| ·Design Review | ·设计复审 | 20 |
| ·Coding Standard | ·代码规范 | 10 |
| ·Design | ·具体设计 | 30 |
| ·Coding | ·具体编码 | 80 |
| ·Code Review | ·代码复审 | 10 |
| ·Test | ·测试 | 10 |
| Reporting | 报告 | 30 |
| ·Test Report | ·测试报告 | 10 |
| ·Size Measurement | ·计算工作量 | 10 |
| ·Postmortem & Process Improvement Plan | ·事后总结,并提出过程改进计划 | 10 |
团队总结:
这次的团队作业对我们来说不是特别难,因为我们已经开始学习在网站上通过连接数据库查询所需要的信息,对这次作业我们还是比较有信心的。
代码规范。
浙公网安备 33010602011771号