欢迎来到冰点文库! | 帮助中心 分享价值,成长自我!
冰点文库
全部分类
  • 临时分类>
  • IT计算机>
  • 经管营销>
  • 医药卫生>
  • 自然科学>
  • 农林牧渔>
  • 人文社科>
  • 工程科技>
  • PPT模板>
  • 求职职场>
  • 解决方案>
  • 总结汇报>
  • ImageVerifierCode 换一换
    首页 冰点文库 > 资源分类 > DOCX文档下载
    分享到微信 分享到微博 分享到QQ空间

    VB用户登录管理系统.docx

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

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

    VB用户登录管理系统.docx

    1、VB用户登录管理系统软件开发环境与工具实验报告实验二实验题目:用户登录及管理系统实验地点:软件实验室一指导老师:王琦实验类型:设计型系 班:计算机科学与技术系1103班 姓 名:秦芳芳(2011100316) 2013年11月22日一实验项目名称:用户登录及管理系统二. 实验目的和任务:1、掌握系统登录界面设计基本流程 2、了解用户管理所要实现的基本功能 3、要求利用三层架构思想机ado.Net相关技术实现程序三. 实验内容及要求:1、能够进行登录验证 2、能够实现对用户的基本管理,管理员能够进行查询添加修改删除 3、利用数据库连接访问数据库,提高安全性四实验步骤:1、class1.vb的代码

    2、:Imports System.Data.SqlClientPublic Class Class1 Dim strconn As String = Me.getstrconn() Public Function yanzheng(ByVal str1 As String) As Integer Dim conn As New SqlConnection conn.ConnectionString = strconn conn.Open() Dim cmd As New SqlCommand cmd.CommandText = select * from student where sname

    3、= & str1 & cmd.Connection = conn cmd.CommandType = CommandType.Text Dim dr As SqlDataReader dr = cmd.ExecuteReader If dr.Read Then dr.Close() conn.Close() Return 1 Else dr.Close() conn.Close() Return 0 End If End Function Public Function pwdyanzheng(ByVal str As String) As SqlDataReader Dim conn As

    4、New SqlConnection conn.ConnectionString = strconn conn.Open() Dim cmd As New SqlCommand cmd.CommandText = select * from student where sname = & str & cmd.Connection = conn Dim dr As SqlDataReader = cmd.ExecuteReader Return dr End Function Public Function getstrconn() As String Dim str As String str

    5、= server= & System.Configuration.ConfigurationManager.AppSettings(server) & ; str &= uid= & System.Configuration.ConfigurationManager.AppSettings(uid) & ; str &= pwd= & System.Configuration.ConfigurationManager.AppSettings(pwd) & ; str &= database= & System.Configuration.ConfigurationManager.AppSett

    6、ings(database) Return str End Function Public Function getalldata() As DataSet Dim conn As New SqlConnection conn.ConnectionString = strconn conn.Open() Dim da As New SqlDataAdapter(select * from student, conn) Dim ds As New DataSet da.Fill(ds, student) conn.Close() Return ds End Function Public Fun

    7、ction insdata(ByVal str1 As String, ByVal str2 As String) As String Dim conn As New SqlConnection conn.ConnectionString = strconn Dim cmd As New SqlCommand cmd.Connection = conn cmd.CommandText = insert into student(sname,sno) values( & str1 & , & str2 & ) Try conn.Open() cmd.ExecuteNonQuery() Retur

    8、n 1 Catch ex As Exception Return -1 & ex.Message End Try conn.Close() End Function Public Function upd(ByVal str1 As String, ByVal str2 As String) As String Dim conn As New SqlConnection conn.ConnectionString = strconn Dim cmd As New SqlCommand cmd.Connection = conn cmd.CommandText = update student

    9、set sno = & str2 & where sname = & str1 & Try conn.Open() cmd.ExecuteNonQuery() Return 1 Catch ex As Exception Return -1 & ex.Message End Try conn.Close() End Function Public Function deldata(ByVal str As String) As String Dim conn As New SqlConnection conn.ConnectionString = strconn Dim cmd As New

    10、SqlCommand cmd.Connection = conn cmd.CommandText = delete from student where sname = & str & Try conn.Open() cmd.ExecuteNonQuery() Return 1 Catch ex As Exception Return -1 & ex.Message End Try conn.Close() End Function Public Function search(ByVal str1 As String) As String Dim conn As New SqlConnect

    11、ion conn.ConnectionString = strconn Dim cmd As New SqlCommand cmd.Connection = conn cmd.CommandText = select * from student Try conn.Open() cmd.ExecuteNonQuery() Return 1 Catch ex As Exception Return -1 & ex.Message End Try conn.Close() End FunctionEnd Class2、进入界面功能的代码:Imports System.Data.SqlClientP

    12、ublic Class Form1 Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click Dim o As New Class1 Dim f As Integer f = o.yanzheng(Me.TextBox1.Text) If f = 0 Then MsgBox(不存在该用户,请重新输入!) Me.TextBox1.Text = Me.TextBox1.Focus() Else If f = 1 Then Dim dr As

    13、SqlDataReader dr = o.pwdyanzheng(Me.TextBox1.Text) dr.Read() If RTrim(dr!sno) Me.TextBox2.Text Then MsgBox(密码错误,请重新输入!) Me.TextBox2.Text = Me.TextBox2.Focus() Else Dim strpwd As String strpwd = Me.TextBox2.Text strpwd = System.Web.Security.FormsAuthentication.HashPasswordForStoringInConfigFile(strpw

    14、d, md5) Dim frm As New Form2 frm.loginname = Me.TextBox1.Text frm.logintime = TimeOfDay frm.Show() Me.Hide() End If End If End If End Sub Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click MyBase.Dispose() End Sub End Class3、用户管理和浏览信息界面的代码: Pu

    15、blic Class Form2 Public loginname As String Public logintime As String Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click Me.Hide() Form3.Show() End Sub Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Hand

    16、les Button2.Click Me.Hide() Form4.Show() End Sub Private Sub Form2_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load Me.loginstatusname.Text = 用户名: & loginname Me.loginstatustime.Text = 登录时间: & logintime End Sub Private Sub Timer1_Tick(ByVal sender As System.Object

    17、, ByVal e As System.EventArgs) Handles Timer1.Tick Me.ToolStripStatusLabel1.Text = Now End SubEnd Class4、增,删,改,查功能页面的代码: Public Class Form3 Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click Me.Hide() del.Show() End Sub Private Sub Button1_Cli

    18、ck(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click Me.Hide() ins.Show() End Sub Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click Me.Hide() upda.Show() End Sub Private Sub Button4_Click(ByVal sender As System

    19、.Object, ByVal e As System.EventArgs) Handles Button4.Click Me.Close() search.Show() End SubEnd Class5、显示信息界面的代码: Public Class Form4 Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click Me.Close() Form2.Show() End Sub Private Sub Form4_Load(ByVa

    20、l sender As Object, ByVal e As System.EventArgs) Handles Me.Load Dim o As New Class1 Dim ds As New DataSet ds = o.getalldata() Me.DataGridView1.Refresh() Me.DataGridView1.DataSource = ds.Tables(student) End SubEnd Class6、插入信息界面的代码: Public Class ins Private Sub Button1_Click(ByVal sender As System.Ob

    21、ject, ByVal e As System.EventArgs) Handles Button1.Click Dim o As New Class1 o.insdata(Me.TextBox1.Text, Me.TextBox2.Text) Me.Close() Form2.Show() End SubEnd Class7、查询信息界面的代码:Public Class search Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Cli

    22、ck Dim o As New Class1 Dim ds As New DataSet o.search(Me.TextBox1.Text) ds = o.getalldata() Me.DataGridView1.Refresh() Me.DataGridView1.DataSource = ds.Tables(student) End Sub Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click Me.Close() Form2

    23、.Show() End Sub Private Sub DataGridView1_CellClick(ByVal sender As Object, ByVal e As System.Windows.Forms.DataGridViewCellEventArgs) Handles DataGridView1.CellClick Me.TextBox1.Text = DataGridView1.CurrentRow.Cells.Item(0).Value.ToString Me.TextBox2.Text = DataGridView1.CurrentRow.Cells.Item(1).Va

    24、lue.ToString Me.TextBox3.Text = DataGridView1.CurrentRow.Cells.Item(2).Value.ToString Me.TextBox4.Text = DataGridView1.CurrentRow.Cells.Item(3).Value.ToString Me.TextBox5.Text = DataGridView1.CurrentRow.Cells.Item(4).Value.ToString End SubEnd Class8、修改信息界面的代码:Public Class upda Private Sub Button1_Cl

    25、ick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click Dim o As New Class1 o.upd(Me.TextBox1.Text, Me.TextBox2.Text) Me.Close() Form2.Show() End SubEnd Class 9、删除信息界面的代码:Public Class del Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventAr

    26、gs) Handles Button1.Click Dim o As New Class1 o.deldata(Me.TextBox1.Text) o.deldata(Me.TextBox1.Text) Me.Close() Form2.Show() End SubEnd Class 五、运行结果及截图:(1)建立数据库(2)运行截图 六、实验总结:通过本次实验,我大致掌握了一个登录系统界面设计的基本流程,同时了解了用户管理所要实现的基本功能,而且能够利用三层架构思想机ado.Net相关技术实现程序,能够进行登录验证,实现了对用户的基本管理,在系统中实现了增删查改的功能,利用数据库连接访问数据库,提高了安全性,为以后的学习打下了很好的基础。


    注意事项

    本文(VB用户登录管理系统.docx)为本站会员主动上传,冰点文库仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对上载内容本身不做任何修改或编辑。 若此文所含内容侵犯了您的版权或隐私,请立即通知冰点文库(点击联系客服),我们立即给予删除!

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




    关于我们 - 网站声明 - 网站地图 - 资源地图 - 友情链接 - 网站客服 - 联系我们

    copyright@ 2008-2023 冰点文库 网站版权所有

    经营许可证编号:鄂ICP备19020893号-2


    收起
    展开