?? dellog.vb
字號:
Me.TextBox2.Name = "TextBox2"
Me.TextBox2.PasswordChar = Microsoft.VisualBasic.ChrW(42)
Me.TextBox2.Size = New System.Drawing.Size(104, 20)
Me.TextBox2.TabIndex = 7
Me.TextBox2.Text = ""
'
'TextBox1
'
Me.TextBox1.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle
Me.TextBox1.Location = New System.Drawing.Point(96, 16)
Me.TextBox1.Name = "TextBox1"
Me.TextBox1.Size = New System.Drawing.Size(104, 20)
Me.TextBox1.TabIndex = 6
Me.TextBox1.Text = ""
'
'OleDbCommand2
'
Me.OleDbCommand2.CommandText = "UPDATE tblSysLogin SET usr_name = ?, usr_pass = ? WHERE (usr_name = ?) AND (usr_p" & _
"ass = ? OR ? IS NULL AND usr_pass IS NULL)"
Me.OleDbCommand2.Connection = Me.OleDbConnection2
Me.OleDbCommand2.Parameters.Add(New System.Data.OleDb.OleDbParameter("usr_name", System.Data.OleDb.OleDbType.VarWChar, 15, "usr_name"))
Me.OleDbCommand2.Parameters.Add(New System.Data.OleDb.OleDbParameter("usr_pass", System.Data.OleDb.OleDbType.VarWChar, 20, "usr_pass"))
Me.OleDbCommand2.Parameters.Add(New System.Data.OleDb.OleDbParameter("Original_usr_name", System.Data.OleDb.OleDbType.VarWChar, 15, System.Data.ParameterDirection.Input, False, CType(0, Byte), CType(0, Byte), "usr_name", System.Data.DataRowVersion.Original, Nothing))
Me.OleDbCommand2.Parameters.Add(New System.Data.OleDb.OleDbParameter("Original_usr_pass", System.Data.OleDb.OleDbType.VarWChar, 20, System.Data.ParameterDirection.Input, False, CType(0, Byte), CType(0, Byte), "usr_pass", System.Data.DataRowVersion.Original, Nothing))
Me.OleDbCommand2.Parameters.Add(New System.Data.OleDb.OleDbParameter("Original_usr_pass1", System.Data.OleDb.OleDbType.VarWChar, 20, System.Data.ParameterDirection.Input, False, CType(0, Byte), CType(0, Byte), "usr_pass", System.Data.DataRowVersion.Original, Nothing))
'
'Button2
'
Me.Button2.BackColor = System.Drawing.Color.Chocolate
Me.Button2.Cursor = System.Windows.Forms.Cursors.Default
Me.Button2.FlatStyle = System.Windows.Forms.FlatStyle.Flat
Me.Button2.Font = New System.Drawing.Font("Microsoft Sans Serif", 8.25!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
Me.Button2.ForeColor = System.Drawing.SystemColors.ControlText
Me.Button2.Location = New System.Drawing.Point(124, 72)
Me.Button2.Name = "Button2"
Me.Button2.RightToLeft = System.Windows.Forms.RightToLeft.No
Me.Button2.Size = New System.Drawing.Size(64, 23)
Me.Button2.TabIndex = 9
Me.Button2.Text = "&Cancel"
'
'Label2
'
Me.Label2.Font = New System.Drawing.Font("Microsoft Sans Serif", 8.25!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
Me.Label2.Location = New System.Drawing.Point(24, 39)
Me.Label2.Name = "Label2"
Me.Label2.Size = New System.Drawing.Size(64, 23)
Me.Label2.TabIndex = 10
Me.Label2.Text = "Password:"
Me.Label2.TextAlign = System.Drawing.ContentAlignment.MiddleRight
'
'OleDbCommand4
'
Me.OleDbCommand4.CommandText = "SELECT usr_name, usr_pass FROM tblSysLogin"
Me.OleDbCommand4.Connection = Me.OleDbConnection2
'
'OleDbDataAdapter2
'
Me.OleDbDataAdapter2.DeleteCommand = Me.OleDbCommand1
Me.OleDbDataAdapter2.InsertCommand = Me.OleDbCommand5
Me.OleDbDataAdapter2.SelectCommand = Me.OleDbCommand4
Me.OleDbDataAdapter2.TableMappings.AddRange(New System.Data.Common.DataTableMapping() {New System.Data.Common.DataTableMapping("Table", "tblSysLogin", New System.Data.Common.DataColumnMapping() {New System.Data.Common.DataColumnMapping("usr_name", "usr_name"), New System.Data.Common.DataColumnMapping("usr_pass", "usr_pass")})})
Me.OleDbDataAdapter2.UpdateCommand = Me.OleDbCommand2
'
'OleDbCommand5
'
Me.OleDbCommand5.CommandText = "INSERT INTO tblSysLogin(usr_name, usr_pass) VALUES (?, ?)"
Me.OleDbCommand5.Connection = Me.OleDbConnection2
Me.OleDbCommand5.Parameters.Add(New System.Data.OleDb.OleDbParameter("usr_name", System.Data.OleDb.OleDbType.VarWChar, 15, "usr_name"))
Me.OleDbCommand5.Parameters.Add(New System.Data.OleDb.OleDbParameter("usr_pass", System.Data.OleDb.OleDbType.VarWChar, 20, "usr_pass"))
'
'Label1
'
Me.Label1.Font = New System.Drawing.Font("Microsoft Sans Serif", 8.25!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
Me.Label1.Location = New System.Drawing.Point(24, 15)
Me.Label1.Name = "Label1"
Me.Label1.Size = New System.Drawing.Size(64, 23)
Me.Label1.TabIndex = 11
Me.Label1.Text = "UserName:"
Me.Label1.TextAlign = System.Drawing.ContentAlignment.MiddleRight
'
'Button1
'
Me.Button1.BackColor = System.Drawing.Color.Chocolate
Me.Button1.Cursor = System.Windows.Forms.Cursors.Default
Me.Button1.FlatStyle = System.Windows.Forms.FlatStyle.Flat
Me.Button1.Font = New System.Drawing.Font("Microsoft Sans Serif", 8.25!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
Me.Button1.ForeColor = System.Drawing.SystemColors.ControlText
Me.Button1.Location = New System.Drawing.Point(36, 72)
Me.Button1.Name = "Button1"
Me.Button1.RightToLeft = System.Windows.Forms.RightToLeft.No
Me.Button1.Size = New System.Drawing.Size(64, 23)
Me.Button1.TabIndex = 8
Me.Button1.Text = "&LogIn"
'
'delLog
'
Me.AcceptButton = Me.Button1
Me.AutoScaleBaseSize = New System.Drawing.Size(5, 13)
Me.ClientSize = New System.Drawing.Size(226, 111)
Me.ControlBox = False
Me.Controls.Add(Me.Label2)
Me.Controls.Add(Me.Label1)
Me.Controls.Add(Me.Button1)
Me.Controls.Add(Me.TextBox2)
Me.Controls.Add(Me.TextBox1)
Me.Controls.Add(Me.Button2)
Me.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedToolWindow
Me.Icon = CType(resources.GetObject("$this.Icon"), System.Drawing.Icon)
Me.MaximizeBox = False
Me.MinimizeBox = False
Me.Name = "delLog"
Me.ShowInTaskbar = False
Me.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen
Me.Text = " HRMS: System Admin"
Me.ResumeLayout(False)
End Sub
#End Region
Public sConn As OleDbConnection
Dim lDS As DataSet = New DataSet
Dim lDA As OleDbDataAdapter = New OleDbDataAdapter
Dim lDR As DataRow
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
sConn.Open()
lDA.SelectCommand = New OleDbCommand("SELECT * FROM tblSysLogin WHERE usr_name='" & TextBox1.Text.ToString & "' and usr_pass='" & TextBox2.Text & "'", sConn)
lDS.Clear()
lDA.Fill(lDS)
If lDS.Tables(0).Rows.Count > 0 Then
Dim fx As New delPay
bExitApplication = False
Me.Close()
fx.Show()
Else
MsgBox("Sorry, you do NOT have Administrative permission. Please contact the System Administrator.", MsgBoxStyle.Exclamation + MsgBoxStyle.OKOnly, "Access Denied")
TextBox1.Focus()
End If
lDR = Nothing
lDS.Dispose()
lDA.Dispose()
sConn.Close()
End Sub
Private Sub delLog_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
sConn = New OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & Application.StartupPath & "\EIS.mdb;Persist Security Info=False")
End Sub
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
Me.Close()
End Sub
End Class
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -