计划:需要一周时间
需求分析:作为一个观众需要知道每一场的比赛得分情况,分数详细,列出局分以便了解比赛的战况。
生成设计文档:需要一个查询界面,和比赛得分的详细记录
设计复审:暂时没有和组员审核
代码规范:Visual Studio 2010
具体设计:1.观众查询界面
具体代码:
public partial class Spectator : Form
{
public Spectator()
{
InitializeComponent();
}
private void Spectator_Load(object sender, EventArgs e)
{
groupBox1.Visible = false;
}
private void btnSelect_Click(object sender, EventArgs e)
{
if (!string.IsNullOrEmpty(comboBox1.Text))
{
groupBox1.Visible = true;
string sql = "select Team from Team where tName='%" + comboBox1.SelectedText + "%'";
SqlDataReader read = SqlHelper.ExecuteReader(sql, null);
if (read.Read())
{
int id = read.GetInt32(2);
string sql1 = "select * from JuFen where tId='%" + id + "%'";
SqlDataReader reader = SqlHelper.ExecuteReader(sql1, null);
if (reader.Read())
{
txtAfirst.Text = reader.GetString(2);
txtASec.Text = reader.GetString(2);
txtAThi.Text = reader.GetString(2);
txtAfou.Text = reader.GetString(2);
txtAfive.Text = reader.GetString(2);
txtBfirst.Text = reader.GetString(3);
txtBSec.Text = reader.GetString(3);
txtBThi.Text = reader.GetString(3);
txtBfou.Text = reader.GetString(3);
txtBfive.Text = reader.GetString(3);
}
}
}
else
{
MessageBox.Show("请输入要查询的比赛队伍!");
groupBox1.Visible = false;
}
}
private void labFirst_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
{
first a = new first();
a.Show();
}
private void comboBox1_TextChanged(object sender, EventArgs e)
{
comboBox1.DroppedDown = true;
string sql = "select tName from Team where tName like '%"+comboBox1.Text.Trim()+"%'";
SqlDataReader read = SqlHelper.ExecuteReader(sql, null);
if (read.Read())
{
comboBox1.Items.Add(read.HasRows);
}
}
代码还未全部写出来
代码复审:还未写完
测试:测试出错
测试报告:数据库连接出错
计算工作量:1天
事后总结:漏洞百出,需要进一步学习