谁来给我解释一下这一串代码是什么意思?小白看了很久都不知道呢
vb.net吧
全部回复
仅看楼主
level 2
Imports System.Data.SqlClient
Public Class Login
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
If CheckBox1.Checked Then
If TextBox1.Text = "admin" And TextBox2.Text = "admin" Then
Main.CreateDatabase()
Main.CreatClientInfTable()
Main.AddUserInf()
Main.LoginCheck = "【超级】"
Main.UserName = TextBox1.Text
Me.Close()
Exit Sub
End If
End If
Try
Dim SQLCmdStr As String = "SELECT UserPwd,UserGrp FROM UserInf WHERE UserName='" & TextBox1.Text & "'"
Dim SQLConn As New SqlConnection(Main.SqlConnStr)
Dim SQLCmd As New SqlCommand(SQLCmdStr, SQLConn)
SQLConn.Open()
Dim SQLAdp As New SqlDataAdapter(SQLCmd)
SQLConn.Close()
Dim TempDataSet As New DataSet
SQLAdp.Fill(TempDataSet)
If TempDataSet.Tables(0).Rows(0).Item(0) = TextBox2.Text Then
Main.LoginCheck = TempDataSet.Tables(0).Rows(0).Item(1)
Main.UserName = TextBox1.Text
SQLConn.Dispose()
Me.Close()
Else
TextBox2.Clear()
End If
Catch sqlExc As SqlException
MsgBox(sqlExc.Message, MsgBoxStyle.OkOnly, "SQL Error")
Catch Exc As Exception
MsgBox(Exc.Message, MsgBoxStyle.OkOnly, "Application Error")
End Try
End Sub
Private Sub Button2_Click(sender As System.Object, e As System.EventArgs) Handles Button2.Click
End
End Sub
Private Sub TextBox2_KeyPress(sender As Object, e As System.Windows.Forms.KeyPressEventArgs) Handles TextBox2.KeyPress
If e.KeyChar = CChar(ChrW(13)) Then
Button1_Click(sender, e)
End If
End Sub
Private Sub TextBox1_KeyPress(sender As Object, e As System.Windows.Forms.KeyPressEventArgs) Handles TextBox1.KeyPress
If e.KeyChar = CChar(ChrW(13)) Then
Button1_Click(sender, e)
End If
End Sub
End Class
2015年05月19日 00点05分 1
level 1
数据库和textbox控件限制输入。怎么了?
2015年05月19日 01点05分 2
level 13
按钮1'2查询连接,文本框按下回车键执行按钮操作。对应按钮
2015年05月19日 07点05分 4
level 11
我的代码 谁放这里了?
2015年05月22日 10点05分 6
应该是好多人有吧
2015年05月24日 11点05分
1