欢迎来到得力文库 - 分享文档赚钱的网站! | 帮助中心 好文档才是您的得力助手!
得力文库 - 分享文档赚钱的网站
全部分类
  • 研究报告>
  • 管理文献>
  • 标准材料>
  • 技术资料>
  • 教育专区>
  • 应用文书>
  • 生活休闲>
  • 考试试题>
  • pptx模板>
  • 工商注册>
  • 期刊短文>
  • 图片设计>
  • ImageVerifierCode 换一换

    2022年源码C#登录注册小程序源码 .pdf

    • 资源ID:27868378       资源大小:40.11KB        全文页数:5页
    • 资源格式: PDF        下载积分:4.3金币
    快捷下载 游客一键下载
    会员登录下载
    微信登录下载
    三方登录下载: 微信开放平台登录   QQ登录  
    二维码
    微信扫一扫登录
    下载资源需要4.3金币
    邮箱/手机:
    温馨提示:
    快捷下载时,用户名和密码都是您填写的邮箱或者手机号,方便查询和重复下载(系统自动生成)。
    如填写123,账号就是123,密码也是123。
    支付方式: 支付宝    微信支付   
    验证码:   换一换

     
    账号:
    密码:
    验证码:   换一换
      忘记密码?
        
    友情提示
    2、PDF文件下载后,可能会被浏览器默认打开,此种情况可以点击浏览器菜单,保存网页到桌面,就可以正常下载了。
    3、本站不支持迅雷下载,请使用电脑自带的IE浏览器,或者360浏览器、谷歌浏览器下载即可。
    4、本站资源下载后的文档和图纸-无水印,预览文档经过压缩,下载后原文更清晰。
    5、试题试卷类文档,如果标题没有明确说明有答案则都视为没有答案,请知晓。

    2022年源码C#登录注册小程序源码 .pdf

    C#登录及注册的小程序1) 主界面( Form1 ) :privatevoid linkLabel1_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e) this .Hide(); Form3 f3 = new Form3 (); f3.ShowDialog(); / 显示注册界面;privatevoid linkLabel2_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e) this .Hide(); Form2 f = new Form2 (); f.ShowDialog(); if (f.DialogResult = DialogResult.OK) this .Visible = true ; / 显示登录界面;privatevoid Form1_FormClosing(object sender, FormClosingEventArgs e) try System.Diagnostics.Process myProcesses = System.Diagnostics.Process .GetProcesses(); foreach (System.Diagnostics.Process myProcess in myProcesses) if (LoginInterface.exe = myProcess.ProcessName) myProcess.Kill(); catch (Exception ee) MessageBox.Show(ee.Message); / 关掉程序;2) 注册界面( Form3 )名师资料总结 - - -精品资料欢迎下载 - - - - - - - - - - - - - - - - - - 名师精心整理 - - - - - - - 第 1 页,共 5 页 - - - - - - - - - 本文使用的数据库是sql sever2005,先在引用里加入:using System.Data.SqlClient; 以下为程序代码:publicpartialclass Form3 : Form public Form3() InitializeComponent(); boolflagRegister;/ 定义标志位,确认用户注册string strConnect = Data Source=CAI-PCSQLEXPRESS;Initial Catalog=MyData1;Persist Security Info=True;User ID=sa;Password=*; / 连接数据库字符串privatevoid button1_Click(object sender, EventArgs e) if (textBox1.Text.Length = 4) & (textBox1.Text.Length = 6) & (textBox3.Text.Length = 6) flagRegister = true ; else if (textBox1.Text.Length 12) MessageBox.Show( 用户名长度不在约定范围内,请重新输入! , 提示 ); return ; if (textBox2.Text.Length 6) MessageBox.Show( 密码长度不足 6位,请重新输入!,提示 ); return ; if (textBox3.Text.Length 6) MessageBox.Show( 请重新输入邮箱!, 提示 ); return ; / 判断用户名条件;if (UserFlag = true ) MessageBox.Show( 用户已经存在,请重新输入!); return ; 名师资料总结 - - -精品资料欢迎下载 - - - - - - - - - - - - - - - - - - 名师精心整理 - - - - - - - 第 2 页,共 5 页 - - - - - - - - - if (flagRegister = true ) / 确认用户注册后,把用户写入数据库 SqlConnection conConnection = new SqlConnection(strConnect); conConnection.Open(); string cmd = insert into 用户 (用户名 ,密码 ,email) values ( + textBox1.Text + ,+ + textBox2.Text + , + + textBox3.Text + ) ; SqlCommand com = new SqlCommand(cmd, conConnection); com.ExecuteNonQuery(); conConnection.Close(); MessageBox.Show( 注册成功!点击确定,返回登录界面。, 提示 ); this .Close(); Form1 f1 = new Form1 (); f1.label2.Text = 欢迎你, + textBox1.Text; f1.label1.Visible = false ; f1.label3.Visible = false ; f1.linkLabel1.Visible = false ; f1.linkLabel2.Visible = false ; f1.label2.Visible = true ; f1.Show(); publicbool UserFlag; / 定义标志位,来确认用户是否存在privatevoid textBox1_TextChanged(object sender, EventArgs e) SqlConnection conConnection = new SqlConnection(strConnect); conConnection.Open(); string cmd = select 用户名from 用户 ; SqlCommand com = new SqlCommand(cmd, conConnection); SqlDataReader readerUser = com.ExecuteReader(); while (readerUser.Read() if (textBox1.Text = readerUser用户名 .ToString().Trim() label5.Text = 用户已存在,请重新输入!; UserFlag = true ; /textBox1.Text = ; return ; else if (textBox1.Text != readerUser用户名 .ToString().Trim() 名师资料总结 - - -精品资料欢迎下载 - - - - - - - - - - - - - - - - - - 名师精心整理 - - - - - - - 第 3 页,共 5 页 - - - - - - - - - label5.Text = 恭喜你,该用户名可以使用。; UserFlag = false ; / 判断用户名是否满足条件privatevoid textBox3_TextChanged(object sender, EventArgs e) int index = textBox3.Text.IndexOf( ); if (index 1) label7.Text = 邮箱格式不正确,请重新输入!; else label7.Text = 邮箱格式正确 ; / 判断邮箱格式是否正确 3) 登录界面( Form2 )本文使用的数据库是sql sever2005,先在引用里加入:using System.Data.SqlClient; 以下为程序代码:string User, Pwd; / 用户名,密码bool flagshow = false ;/ 用来标注登录名是否存在于数据库privatevoid linkLabel1_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e) this .Hide(); Form3 f3 = new Form3 (); f3.ShowDialog(); / 显示注册界面privatevoid button1_Click(object sender, EventArgs e) / 登录string strConnect = Data Source=CAI-PCSQLEXPRESS;Initial Catalog=MyData1;Persist Security Info=True;User ID=sa;Password=*; SqlConnection conConnection = new SqlConnection(strConnect); conConnection.Open(); string cmd = select 用户名 ,密码 ,email from 用户 ; 名师资料总结 - - -精品资料欢迎下载 - - - - - - - - - - - - - - - - - - 名师精心整理 - - - - - - - 第 4 页,共 5 页 - - - - - - - - - SqlCommand com = new SqlCommand(cmd, conConnection); SqlDataReader reader = com.ExecuteReader(); while (reader.Read()/ 从数据库读取用户信息 User = reader用户名 .ToString(); Pwd = reader密码 .ToString(); if (User.Trim () = textBox1.Text & Pwd.Trim () = textBox2.Text) flagshow = true ; / 用户名存在于数据库,则为true reader.Close(); conConnection.Close(); if (flagshow = true ) showMainForm();/ 用户存在,返回登录界面 else MessageBox.Show( 用户不存在或密码错误!, 提示 ); return ; privatevoid showMainForm()/ 登录成功,显示主界面 this .Close(); Form1 f1 = new Form1 (); f1.label1.Visible = false ; f1.label3.Visible = false ; f1.linkLabel1.Visible = false ; f1.linkLabel2.Visible = false ; f1.label2.Visible = true ; f1.label2.Text = 欢迎你, + textBox1 .Text ; f1.Show(); 名师资料总结 - - -精品资料欢迎下载 - - - - - - - - - - - - - - - - - - 名师精心整理 - - - - - - - 第 5 页,共 5 页 - - - - - - - - -

    注意事项

    本文(2022年源码C#登录注册小程序源码 .pdf)为本站会员(Q****o)主动上传,得力文库 - 分享文档赚钱的网站仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对上载内容本身不做任何修改或编辑。 若此文所含内容侵犯了您的版权或隐私,请立即通知得力文库 - 分享文档赚钱的网站(点击联系客服),我们立即给予删除!

    温馨提示:如果因为网速或其他原因下载失败请重新下载,重复下载不扣分。




    关于得利文库 - 版权申诉 - 用户使用规则 - 积分规则 - 联系我们

    本站为文档C TO C交易模式,本站只提供存储空间、用户上传的文档直接被用户下载,本站只是中间服务平台,本站所有文档下载所得的收益归上传人(含作者)所有。本站仅对用户上传内容的表现方式做保护处理,对上载内容本身不做任何修改或编辑。若文档所含内容侵犯了您的版权或隐私,请立即通知得利文库网,我们立即给予删除!客服QQ:136780468 微信:18945177775 电话:18904686070

    工信部备案号:黑ICP备15003705号-8 |  经营许可证:黑B2-20190332号 |   黑公网安备:91230400333293403D

    © 2020-2023 www.deliwenku.com 得利文库. All Rights Reserved 黑龙江转换宝科技有限公司 

    黑龙江省互联网违法和不良信息举报
    举报电话:0468-3380021 邮箱:hgswwxb@163.com  

    收起
    展开