标签:顺序 toe exec oev odi runtime charset send pil
后台代码:
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data.SqlClient;
using System.Data;
using System.Configuration;
public partial class FootGame : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
if(!this.Page.IsPostBack)
{
InitGamePage();
}
}
public void InitGamePage()
{
string sql = "select FootMark from dbo.FootSum";
SqlConnection con = new SqlConnection(ConfigurationManager.ConnectionStrings["conn"].ConnectionString);
SqlDataAdapter sda = new SqlDataAdapter(sql, con);
DataSet ds = new DataSet();
sda.Fill(ds);
if(ds.Tables[0].Rows.Count>0)
{
txtAsum.Text = ds.Tables[0].Rows[0]["FootMark"].ToString();
txtBsum.Text = ds.Tables[0].Rows[1]["FootMark"].ToString();
}
}
protected void btnAsum_Click(object sender, EventArgs e)
{
string sql1 = "update dbo.FootSum set FootMark=FootMark+1 where FootID=1";
SqlConnection con = new SqlConnection(ConfigurationManager.ConnectionStrings["conn"].ConnectionString);
SqlCommand cmd1 = new SqlCommand(sql1,con);
con.Open();
int flag = cmd1.ExecuteNonQuery();
con.Close();
string sql = "select FootMark from dbo.FootSum where FootID=1";
SqlDataAdapter sda = new SqlDataAdapter(sql, con);
DataSet ds = new DataSet();
sda.Fill(ds);
int values = Convert.ToInt32(ds.Tables[0].Rows[0][0].ToString());
if (values >= 3)
{
Page.ClientScript.RegisterStartupScript(this.GetType(),"","<script>alert(‘巴西队获胜‘);</script>");
}
InitGamePage();
}
protected void btnBsum_Click(object sender, EventArgs e)
{
string sql1 = "update dbo.FootSum set FootMark=FootMark+1 where FootID=2";
SqlConnection con = new SqlConnection(ConfigurationManager.ConnectionStrings["conn"].ConnectionString);
SqlCommand cmd1 = new SqlCommand(sql1, con);
con.Open();
int flag = cmd1.ExecuteNonQuery();
con.Close();
string sql = "select FootMark from dbo.FootSum where FootID=2";
SqlDataAdapter sda = new SqlDataAdapter(sql, con);
DataSet ds = new DataSet();
sda.Fill(ds);
int values = Convert.ToInt32(ds.Tables[0].Rows[0][0].ToString());
if (values >= 3)
{
Page.ClientScript.RegisterStartupScript(this.GetType(), "", "<script>alert(‘阿根廷队获胜‘);</script>");
}
InitGamePage();
}
protected void btnSumClear_Click(object sender, EventArgs e)
{
string sql = "update dbo.FootSum set FootMark=0";
SqlConnection con = new SqlConnection(ConfigurationManager.ConnectionStrings["conn"].ConnectionString);
SqlCommand cmd = new SqlCommand(sql, con);
con.Open();
int flag = cmd.ExecuteNonQuery();
con.Close();
Page.ClientScript.RegisterStartupScript(this.GetType(), "", "<script>alert(‘分数清除成功‘);</script>");
InitGamePage();
}
}
标签:顺序 toe exec oev odi runtime charset send pil
原文地址:http://www.cnblogs.com/zzyzzyzzy/p/6213161.html