创建一个新的用户注册窗体(VIPRegistration.cs):

用户注册窗体(VIPRegistration.cs)详细代码如下:

 using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using System.Data.SqlClient;
using System.Configuration; namespace 会员管理系统
{
public partial class VIPRegistration : Form
{
public VIPRegistration()
{
InitializeComponent();
} //提交按钮
private void btnOK_Click(object sender, EventArgs e)
{ string connstr = ConfigurationManager.ConnectionStrings["str"].ConnectionString;
SqlConnection conn = new SqlConnection(connstr);
string sql = string.Format("select vusername from VipAccount where vUserName='{0}' ",txtName.Text);
SqlCommand cmd = new SqlCommand(sql, conn);
conn.Open();
SqlDataReader sda=cmd.ExecuteReader(); if (txtName.Text.Trim() == "")
{
lblName.Text="用户名不能为空";
return;
}
else if (txtPwd.Text.Trim() == ""|| txtPwdConfirm.Text.Trim()=="")
{
lblPwd.Text = "密码不能为空";
return;
}
else if (txtPwdConfirm.Text.Trim()!= txtPwd.Text.Trim())
{
lblPwdConfirm.Text = "两次密码输入不同,请确认后再输";
return;
}
else if (sda.Read())
{
lblName.Text = "用户名已存在,请重新输入";
return;
}
else
{
conn.Close();
SqlConnection conninsert = new SqlConnection(connstr);
string insertsql = string.Format("insert into VipAccount(vUserName,vUserPwd) values('{0}','{1}')",txtName.Text,txtPwd.Text);
SqlCommand cmdinsert = new SqlCommand(insertsql, conninsert);
conninsert.Open();
int n = cmdinsert.ExecuteNonQuery();
if (n == )
{
MessageBox.Show("注册失败,请重新输入");
}
else
{
MessageBox.Show("注册成功");
}
conninsert.Close(); }
//conn.Close();
} //返回主菜单
private void btnBack_Click(object sender, EventArgs e)
{
VIPMain vm = new VIPMain();
vm.Show();
this.Hide();
} private void VIPRegistration_Load(object sender, EventArgs e)
{
lblName.Text = "";
lblPwd.Text = "";
lblPwdConfirm.Text = "";
} }
}

主界面窗体(VIPMain.cs)添加一个新的按钮:

用户注册按钮代码:

         private void btnRegistration_Click(object sender, EventArgs e)
{
VIPRegistration vrn = new VIPRegistration();
vrn.Show();
this.Hide();
}

C#_会员管理系统:开发五(用户注册)的更多相关文章

  1. C#_会员管理系统:开发八(权限分配)

    数据库设计 这里由于增加了普通用户权限值,我们需要对数据库结构稍作修改.这里在MovieAccount表中增加4列内容 分别用于 RightFManager       判断普通用户管理界面权限   ...

  2. C#_会员管理系统:开发七(用户分类)

    登录界面(VIPLogin.cs)详细代码: using System; using System.Collections.Generic; using System.ComponentModel; ...

  3. C#_会员管理系统:开发六(数据搜索)

    增加界面中的搜索功能 会员资料管理界面(VIPManager.cs): 详细代码如下: using System; using System.Collections.Generic; using Sy ...

  4. C#_会员管理系统:开发四(日志查看)

    新建一个日志查看窗体: 日志需要的登录时间和登录状态信息由用户刚登录程序时就提供,所以在登录窗体(VIPLogin.cs)中添加代码: //定义一个全局变量 Uid; //用于获取登录成功后的用户名 ...

  5. C#_会员管理系统:开发三(修改密码)

    为以后多个功能界面考虑,新增一个主界面: 主界面如下: 主界面(VIPMain.cs)详细代码如下: using System; using System.Collections.Generic; u ...

  6. C#_会员管理系统:开发二(会员资料管理界面的‘增删改查’)

    会员资料管理界面: 新建一个窗体,窗体界面和控件如下: 窗体中的控件dgvManager更改FullRowSelect属性(点击选中效果)为:FullRowSelect 会员资料管理界面窗体的详细代码 ...

  7. C#_会员管理系统:开发一(用户登录)

    首先创建数据库: [Vip] 创建三张表: 分别是: [VipInformation](会员信息) [Log](日志) [VipAccount](账户权限) 详细语句: --创建数据库[Vip] cr ...

  8. C#_会员管理系统

    https://www.cnblogs.com/start-from-scratch/p/5420588.html

  9. 会员管理系统的设计和开发(2)-- RDLC报表的设计及动态加载

    在上篇<会员管理系统的设计和开发(1)>介绍了关于会员系统的一些总体设计思路和要点,经过一段时间开发,软件终于完成并发布.在这期间,碰到了不少技术难点,并积累了不少开发心得和经验,本篇继续 ...

随机推荐

  1. C语言:类似linux内核的分等级DEBUG宏(打印宏)

    总结几种log打印printf函数的宏定义 http://blog.chinaunix.net/uid-20564848-id-73402.html #include <stdio.h> ...

  2. ES6学习笔记:Module的基本用法

    export和import ES6实现了模块功能,试图解决JavaScript代码上的依赖和部署上的问题,取代现有的CommonJs的AMD规范,成为浏览器和服务器通用的模块解决方案. 模块功能有两个 ...

  3. 0610 python 基础03

    复习: 条件判断 if..else >>> age=28 >>> if age<18: ...   print "你还没有成年吧" ... ...

  4. Aptana jQuery自动提示

    参考 http://www.ghugo.com/aptana-studio-3-jquery-autocomplete/ 对于第一种方案 是每个项目都能生效的  不过有时候网络不好时就无法顺利获取提示 ...

  5. AnyEvent::HTTP 实现异步请求

    异步http: jrhmpt01:/root/async# cat a1.pl use LWP::UserAgent; use utf8; use DBI; use POSIX; use HTTP:: ...

  6. USACO 2001 OPEN

    第1题 绿组. 奶牛接力赛[relay] 题目描述 农夫约翰已经为一次赛跑选出了K(2≤K≤40)头牛组成了一支接力队.赛跑在农夫约翰所拥有的农场上进行,农场的编号为1到Ⅳf4≤Ⅳ< 800), ...

  7. GTW likes math(简单数学)

    GTW likes math  Accepts: 472  Submissions: 2140  Time Limit: 2000/1000 MS (Java/Others)  Memory Limi ...

  8. hdu4336 Card Collector 状态压缩dp

    Card Collector Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others) Tota ...

  9. linux内核源码阅读之facebook硬盘加速利器flashcache

    从来没有写过源码阅读,这种感觉越来越强烈,虽然劣于文笔,但还是下定决心认真写一回. 源代码下载请参见上一篇flashcache之我见 http://blog.csdn.net/liumangxiong ...

  10. CSS+DIV标签命名规范 搜索引擎最喜欢

    搜索引擎优化(seo)有很多工作要做,其中对代码的优化是一个很关键的步骤.为了更加符合SEO的规范,下面是目前流行的CSS+DIV的命名规则: 登录条:loginBar  标志:logo  侧栏:si ...