| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 2070 人关注过本帖
标题:应输入 class、delegate、enum、interface 或 struct
只看楼主 加入收藏
invincibleqq
Rank: 1
等 级:新手上路
帖 子:1
专家分:0
注 册:2010-6-14
结帖率:0
收藏
已结贴  问题点数:5 回复次数:1 
应输入 class、delegate、enum、interface 或 struct
我在编译连接数据库登入功能的时候   取消按钮的指令

        private void btnCancel_Click(object sender, EventArgs e)
        {
            txtName.Text = "";
            txtPwd.Text = "";
            txtName.Focus();
        }
提示错误  说" 应输入 class、delegate、enum、interface 或 struct"


完整指令:
using System;
using System.Collections.Generic;
using
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Data.SqlClient;
namespace MySchool
{
    public partial class Login : Form
    {
        public Login()
        {
            InitializeComponent();
        }

        private void Login_Load(object sender, EventArgs e)
        {

        }

        private void btnYes_Click(object sender, EventArgs e)
        {
            string userName = txtName.Text;
            string password = txtPwd.Text;
            string connString=@"Data Source=f-pc;Initial Catalog=MySchool;Integrated Security=True";
            SqlConnection connection=new SqlConnection (connString);
            string sql=String.Format("select count(*) from [User] where userName='{0}' and password='{1}'",userName,password );
            try
            {
                connection.Open ();
                SqlCommand command=new SqlCommand(sql,connection );
                int num=(int)command.ExecuteScalar();
                if(num> 0 )
                {
                    MessageBox.Show("欢迎进入成绩管理系统!","登入成功", MessageBoxButtons.OK,MessageBoxIcon.Information);
                    MainFrm mainForm=new MainFrm();
                    mainForm.Show();
                    this.Visible=false;
                }
                else
                {
                  MessageBox.Show ("您输入的用户名或密码错误!","登入失败",MessageBoxButtons.OK,MessageBoxIcon.Exclamation );
                }
            }
              catch (Exception ex)
              {
              MessageBox.Show (ex.Message,"操作数据库出错!",MessageBoxButtons.OK ,MessageBoxIcon.Exclamation );
              }
              finally
              {
                connection.Close();
              }
            }}
  
        private void btnCancel_Click(object sender, EventArgs e)
        {
            txtName.Text = "";
            txtPwd.Text = "";
            txtName.Focus();
        }

    }
(跟着书一步一步做的)
希望达人帮我解答一下
搜索更多相关主题的帖子: delegate interface enum struct class 
2010-06-14 12:54
athenalux
Rank: 11Rank: 11Rank: 11Rank: 11
来 自:河北石家庄
等 级:小飞侠
威 望:8
帖 子:975
专家分:2514
注 册:2008-11-26
收藏
得分:5 
{}不成对

QQ:81704464
2010-06-14 15:05
快速回复:应输入 class、delegate、enum、interface 或 struct
数据加载中...
 
   



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

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