标题:编译后显示错误为private处,命名空间并不直接包含诸如字段或方法之类的成员
只看楼主
apple0129
Rank: 1
等 级:新手上路
帖 子:39
专家分:0
注 册:2008-3-28
 问题点数:0 回复次数:1 
编译后显示错误为private处,命名空间并不直接包含诸如字段或方法之类的成员
namespace zyp
{
    /// <summary>
    /// login 的摘要说明。
    /// </summary>
    public class login : System.Web.UI.Page
    {
        protected System.Web.UI.WebControls.Label Label1;
        protected System.Web.UI.WebControls.Label Label2;
        protected System.Web.UI.WebControls.TextBox textuser;
        protected System.Web.UI.WebControls.RadioButton rbtnsupper;
        protected System.Web.UI.WebControls.RadioButton rbtnsystem;
        protected System.Web.UI.WebControls.RadioButton rbtnuser;
        protected System.Web.UI.WebControls.ImageButton ibtnlogin;
        protected System.Web.UI.WebControls.ImageButton ibtncancel;
        protected System.Web.UI.WebControls.RequiredFieldValidator RequiredFieldValidator1;
        protected System.Web.UI.WebControls.TextBox textpwd;
        protected System.Web.UI.WebControls.RequiredFieldValidator RequiredFieldValidator2;
    
        private void Page_Load(object sender, System.EventArgs e)
        {
            if (!IsPostBack)
            {
                this.textuser.Text="";
                this.textpwd.Text= "";
            }// 在此处放置用户代码以初始化页面
        }
        #region Web 窗体设计器生成的代码
        override protected void OnInit(EventArgs e)
        {
            //
            // CODEGEN: 该调用是 Web 窗体设计器所必需的。
            //
            InitializeComponent();
            base.OnInit(e);
        }
        
        /// <summary>
        /// 设计器支持所需的方法 - 不要使用代码编辑器修改
        /// 此方法的内容。
        /// </summary>
        
        #endregion
        #region Web 窗体设计器生成的代码
        
        }
        
        /// <summary>
        /// 设计器支持所需的方法 - 不要使用代码编辑器修改
        /// 此方法的内容。
        /// </summary>
        private void InitializeComponent()
        {   
            this.ibtnlogin.Click += new System.Web.UI.ImageClickEventHandler(this.ImageButton1_Click);
            this.ibtncancel.Click += new System.Web.UI.ImageClickEventHandler(this.ImageButton2_Click);
            this.Load += new System.EventHandler(this.Page_Load);

        }
        #endregion
        private void ibtnlogin_Click(object sender, System.EventArgs e)
        {  
            if (rbtnsupper.Checked)//如果管理员单选按钮选中
            {
                

                SqlConnection conn = new SqlConnection("server=.;uid=sa;pwd=;database=peisong");
                conn.Open();
                
                SqlCommand comm = new SqlCommand("select dlname,pwd  from user where dlname='" + textuser.Text.ToString().Trim() + "'and pwd='" + textpwd.Text.ToString().Trim() + "' and powerid='1'", conn);
                SqlDataReader dr = comm.ExecuteReader();
                if (dr.Read())
                {
                    Response.Redirect("main.aspx");
                    
                }
                else
                {
                    Response.Write("<script>alert('用户名或者密码错误,登录失败!')</script>");
                }
                conn.Close();
            }
        }

        private void ImageButton1_Click(object sender, System.Web.UI.ImageClickEventArgs e)
        {
        
        }

        private void ImageButton2_Click(object sender, System.Web.UI.ImageClickEventArgs e)
        {
        
        }
    }
搜索更多相关主题的帖子: 字段 private 成员 空间 编译 
2008-04-08 18:30
小乌龟
Rank: 2
等 级:新手上路
威 望:4
帖 子:1291
专家分:0
注 册:2007-9-28
得分:0 
please add the below namespace:
using System.Data.SqlClient;
2008-04-08 18:38



参与讨论请移步原网站贴子:https://bbs.bccn.net/thread-207840-1-1.html




关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.256554 second(s), 7 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved