' Memasukkan data dari tabel Role (RoleId & RoleName)
' ke dalam ComboBox Role
Sub Sort_CbRole()
cbRole.Items.Clear()
cbRole.Items.Add("- PILIH -")
objCommand = MyConnection.open.CreateCommand
objCommand.CommandText = ("SELECT (Role.RoleID & ' - '& Role.RoleName) as [RoleN] FROM Role;")
objdatareader = objCommand.ExecuteReader
While objdatareader.Read
cbRole.Items.Add(objdatareader.Item("RoleN"))
End While
MyConnection.close()
cbRole.SelectedIndex = 0
End Sub
' Memasukkan data dari tabel Karyawan (NIK & Nama)
' ke dalam ComboBox Nama
Sub Sort_CbNama()
cbNama.Items.Clear()
cbNama.Items.Add("- PILIH -")
objCommand = MyConnection.open.CreateCommand
objCommand.CommandText = ("SELECT (Karyawan.NIK & ' - '& Karyawan.FirstName) as [Nama]FROM Karyawan;")
objdatareader = objCommand.ExecuteReader
While objdatareader.Read
cbNama.Items.Add(objdatareader.Item("Nama"))
End While
MyConnection.close()
cbNama.SelectedIndex = 0
End Sub
' Memasukkan data dari tabel Users & Karyawan (Inner Join)
' ke dalam ComboBox Search
Sub Sort_CbSearch()
cbSearch.Items.Clear()
cbSearch.Items.Add("- PILIH -")
objCommand = MyConnection.open.CreateCommand
objCommand.CommandText = ("SELECT (Users.NIK & ' - '& Karyawan.FirstName) as [Nama] " & _
" FROM Karyawan INNER JOIN Users ON Karyawan.NIK = Users.NIK;")
objdatareader = objCommand.ExecuteReader
While objdatareader.Read
cbSearch.Items.Add(objdatareader.Item("Nama"))
End While
MyConnection.close()
cbSearch.SelectedIndex = 0
End Sub
' ke dalam ComboBox Role
Sub Sort_CbRole()
cbRole.Items.Clear()
cbRole.Items.Add("- PILIH -")
objCommand = MyConnection.open.CreateCommand
objCommand.CommandText = ("SELECT (Role.RoleID & ' - '& Role.RoleName) as [RoleN] FROM Role;")
objdatareader = objCommand.ExecuteReader
While objdatareader.Read
cbRole.Items.Add(objdatareader.Item("RoleN"))
End While
MyConnection.close()
cbRole.SelectedIndex = 0
End Sub
' Memasukkan data dari tabel Karyawan (NIK & Nama)
' ke dalam ComboBox Nama
Sub Sort_CbNama()
cbNama.Items.Clear()
cbNama.Items.Add("- PILIH -")
objCommand = MyConnection.open.CreateCommand
objCommand.CommandText = ("SELECT (Karyawan.NIK & ' - '& Karyawan.FirstName) as [Nama]FROM Karyawan;")
objdatareader = objCommand.ExecuteReader
While objdatareader.Read
cbNama.Items.Add(objdatareader.Item("Nama"))
End While
MyConnection.close()
cbNama.SelectedIndex = 0
End Sub
' Memasukkan data dari tabel Users & Karyawan (Inner Join)
' ke dalam ComboBox Search
Sub Sort_CbSearch()
cbSearch.Items.Clear()
cbSearch.Items.Add("- PILIH -")
objCommand = MyConnection.open.CreateCommand
objCommand.CommandText = ("SELECT (Users.NIK & ' - '& Karyawan.FirstName) as [Nama] " & _
" FROM Karyawan INNER JOIN Users ON Karyawan.NIK = Users.NIK;")
objdatareader = objCommand.ExecuteReader
While objdatareader.Read
cbSearch.Items.Add(objdatareader.Item("Nama"))
End While
MyConnection.close()
cbSearch.SelectedIndex = 0
End Sub