码迷,mamicode.com
首页 > 其他好文 > 详细

排球计分程序

时间:2016-12-18 17:35:32      阅读:135      评论:0      收藏:0      [点我收藏+]

标签:match   label   reader   back   string   bsp   com   ack   database   

一、计划

技术分享

 

二、程序界面设计

技术分享

 

三、运行结果

技术分享

四、代码部分

public class Match
{
public int id;
public int h1F;
public int h2F;
public int h3F;
public int l1F;
public int l2F;
public int l3F;
}

public class dal
{
public Match Select(int id)
{
string strCon = "server=.;database=pqMatch;integrated security=true";
SqlConnection con = new SqlConnection(strCon);
string sql = "select * from Match where id="+id;
SqlCommand comm = new SqlCommand(sql, con);
con.Open();
Match mc = null;
SqlDataReader reader = comm.ExecuteReader();
if (reader.HasRows)
{
while (reader.Read())
{
mc = new Match();
mc.id = 1;
mc.h1j =(int) reader["h1F"];
mc.h2j = (int)reader["h2F"];
mc.h3j = (int)reader["h3F"];
mc.l1j = (int)reader["l1F"];
mc.l2j = (int)reader["l2F"];
mc.l3j = (int)reader["l3F"];
}
}
reader.Close();
con.Close();
return mc;
}
}

public class bll
{
private dal dl = new dal();
public Match Select(int id)
{
return dl.Select(id);
}
}

private bll bl1 = new bll();
protected void Page_Load(object sender, EventArgs e)
{

}

protected void Button1_Click(object sender, EventArgs e)
{
if (!IsPostBack)
{
txt1h.Text = "";
txt2h.Text = "";
txt3h.Text = "";
txt1l.Text = "";
txt2l.Text = "";
txt3l.Text = "";
}
else
{
string id = Label1.Text.Trim();
Match mc = bl1.Select(Convert.ToInt32(id));
txt1h.Text = mc.h1F.ToString();
txt2h.Text = mc.h2F.ToString();
txt3h.Text = mc.h3F.ToString();
txt1l.Text = mc.l1F.ToString();
txt2l.Text = mc.l2F.ToString();
txt3l.Text = mc.l3F.ToString();
}
int ah=Convert.ToInt32(txt1h.Text);
int bh = Convert.ToInt32(txt2h.Text);
int ch = Convert.ToInt32(txt3h.Text);
int al = Convert.ToInt32(txt1l.Text);
int bl = Convert.ToInt32(txt2l.Text);
int cl = Convert.ToInt32(txt3l.Text);
int zfh = 0;
int zfl = 0;
if (ah > al)
{
zfh++;
}
else
{
zfl++;
}
if (bh > bl)
{
zfh++;
}
else
{
zfl++;
}
if (ch > cl)
{
zfh++;
}
else
{
zfl++;
}
if (dh > dl)
{
zfh++;
}
else
{
zfl++;
}
if (eh > el)
{
zfh++;
}
else
{
zfl++;
}

 

排球计分程序

标签:match   label   reader   back   string   bsp   com   ack   database   

原文地址:http://www.cnblogs.com/f13781251665/p/6194578.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!