zoukankan      html  css  js  c++  java
  • 投票处理页面 vote.aspx.cs

    using System;
    using System.Data;
    using System.Configuration;
    using System.Web;
    using System.Web.Security;
    using System.Web.UI;
    using System.Web.UI.WebControls;
    using System.Web.UI.WebControls.WebParts;
    using System.Web.UI.HtmlControls;
    using System.Data.SqlClient;    //自己导入命名空间.
    public partial class _Default : System.Web.UI.Page
    {

            private string voteID = "1";
            protected void Page_Load(object sender, EventArgs e)
            {
                SqlConnection con = DB.createConnection();
                con.Open();
                SqlCommand cmd = new SqlCommand("select voteTitle from voteMaster where voteID="+this.voteID,con);               //this.voteID=1 本页变量
                string title = Convert.ToString(cmd.ExecuteScalar()); //返回首行首列;
                this.lbltitle.Text = title;

                SqlCommand cmdItem = new SqlCommand("select voteDetailsID,voteItem from voteDetails where voteID="+this.voteID,con);
                SqlDataReader sdr = cmdItem.ExecuteReader();   //返回查询结果
     
                this.rBtnItems.DataTextField = "voteItem";
                this.rBtnItems.DataValueField = "voteDetailsID";
            
                this.rBtnItems.DataSource = sdr;
                this.rBtnItems.DataBind();

                sdr.Close();
               // con.Close();
            }

        protected void rBtnItems_SelectedIndexChanged(object sender, EventArgs e)
        {

        }
        protected void btnVote_Click(object sender, EventArgs e)
        {
            //SqlConnection con =D
        }
    }

  • 相关阅读:
    【Luogu】P1419寻找段落(单调队列)
    【Luogu】P1411树(树形高精DP)
    【Luogu】P2886牛继电器(矩阵加速floyd)
    【Luogu】P2657windy数(数位DP)
    【Luogu】P3521ROT-Tree Rotations(线段树合并)
    24-Perl 数据库连接
    23-Perl 面向对象
    22-Perl Socket 编程
    21-Perl 发送邮件
    20-Perl 正则表达式
  • 原文地址:https://www.cnblogs.com/gfwei/p/521955.html
Copyright © 2011-2022 走看看