日期:2014-05-17 浏览次数:20872 次
private void start_Click(object sender, EventArgs e)
{
//开始抽奖
if (timer1.Enabled == false)
{
timer1.Enabled = true;
}
else
{
//这步应该做判断,数据库中表中是否存在号码,如果有不允许被抽取
//保存抽取结果
luck_update = "insert into zj_hm (zj_number) values
('" + label1.Text + "')";
SqlConnection conn_update = new SqlConnection(my_conn.sql_conn());
SqlCommand cmd_update = new SqlCommand(luck_update, conn_update);
conn_update.Open();
cmd_update.ExecuteNonQuery();
timer1.Enabled = false;
}
}
//计时器Timer
private void timer1_Tick(object sender, EventArgs e)
{
//在表中抽奖号段范围内抽取随机号;开始号码,截至号码
luck = "select * from cj_hdnr";
SqlConnection conn = new SqlConnection(my_conn.sql_conn());
SqlCommand cmd = new SqlCommand(luck,conn);
conn.Open();
SqlDataReader rs = cmd.ExecuteReader();
if(rs.Read())
{
start = Convert.ToInt32(rs["hd_kaishi_haoma"]);
end = Convert.ToInt32(rs["hd_jieshu_haoma"]);
&nb