当前位置:编程学习 > C#/ASP.NET >>

帮忙解释一段登录代码

Private Sub Button1_Click(ByVal sender As System.Object, _
                              ByVal e As System.EventArgs) _
                              Handles Button1.Click
        User = Me.TextBox1.Text.Trim
        Password = Me.TextBox2.Text.Trim
        sqlstr = "SELECT * FROM UserInfo WHERE user_id= " & _
        "'" & User & "' AND user_pwd='" & Password & "'"
        Dim objDataRow As DataRow
        Try
            objDataRow = GetDataFromDB(sqlstr).Tables(0).Rows(0)
        Catch
            MsgBox("密码和账号不符,请重试,并检查该账号是否存在。", _
            MsgBoxStyle.Information + MsgBoxStyle.OKOnly, "系统登录失败")
            Me.TextBox2.Text = ""
            Exit Sub
        End Try
        UserName = User
        pepdom = objDataRow.Item(2)
        mod1 = CBool(objDataRow.Item(3))
        mod2 = CBool(objDataRow.Item(4))
        mod3 = CBool(objDataRow.Item(5))
        mod4 = CBool(objDataRow.Item(6))
        Dim frmmain As New Form1()
        frmmain.Show()
        Me.Finalize()
    End Sub
    主要是End Try后面的6行,这一部分是在说什么?
    谢谢,新手上路,解释的详细点:)
--------------------编程问答-------------------- 他似乎在去用户信息,比如姓名,电话等。 --------------------编程问答-------------------- 取用户信息啊,然后保存在变量中,具体是什么信息去查一下表结构。 --------------------编程问答-------------------- 取用户信息,转换为布尔值,这个是为了判断数据库中是否存在这个信息吧?

MsgBox("密码和账号不符,请重试,并检查该账号是否存在。", _
    MsgBoxStyle.Information + MsgBoxStyle.OKOnly, "系统登录失败")

这个写在Catch句中可以么? --------------------编程问答-------------------- 去查查数据表结构,很大可能是权限 --------------------编程问答-------------------- 哦,有道理。 --------------------编程问答-------------------- Me.Finalize()
这个又是什么意思呀 --------------------编程问答-------------------- Allows the Device structure to free resources before it is destroyed by the garbage collector.(MSDN) 

用来释放没有用到的资源的。 --------------------编程问答-------------------- 数据结构表是:

  user_id   user_pwd  user_pepdom  user_mod1  user_mod2  user_mod3  user_mod4
  admin     12345     0            0          0          0          0
  hzc       12345     1            0          0          0          0
  yhj       12345     2            1          1          1          1

表中后几列不知道代表什么意思 --------------------编程问答-------------------- 还是不明白,数据机构表的后几列有什么用? --------------------编程问答-------------------- 可能是权限,在用户今后的操作前会判断他/她是否有相应的权限。 --------------------编程问答-------------------- 0,没有权限;1,有权限。 --------------------编程问答-------------------- Me.Finalize()
清空应用程序所占用的内存
补充:.NET技术 ,  VB.NET
CopyRight © 2012 站长网 编程知识问答 www.zzzyk.com All Rights Reserved
部份技术文章来自网络,