Yang bertanda tangan di bawah ini, menerangkan bahwa Mahasiswi semester akhir Program Diploma III Teknik Informatika :
Nama : RUISYA SYARIFUDDIN N I M : 092406041
Program Studi : Teknik Informatika
Judul Tugas Akhir : Sistem Informasi Akademik pada SMA Swasta Hang Tuah Belawan
Telah melaksanakan uji program Tugas Akhir Mahasiswi tersebut di atas pada tanggal : Mei 2012
Dengan Hasil : SUKSES / GAGAL
Demikian diterangkan untuk digunakan melengkapi syarat pendaftaran Ujian Meja Hijau Tugas Akhir Mahasiswi yang bersangkutan di Departemen Matematika FMIPA USU Medan.
Medan, Juni 2012 Dosen Pembimbing
Drs. Suyanto, M.Kom
Lampiran
Listing program :
Form data siswa :
Imports MySql.Data.MySqlClient Public Class FrmDatasiswa
Dim strConnectedDb As String
Dim MySQLConnection As MySqlConnection = New MySqlConnection
Dim adapter As MySqlDataAdapter Dim table As DataTable
Dim SQLStatement As String
Dim ConnectionString As String = "Server=localhost; User Id=root; Database=dbsekolah"
Public Sub ExecuteQuery(ByVal Statement As String) Try MySQLConnection.Close() MySQLConnection.ConnectionString = ConnectionString MySQLConnection.Open() SQLStatement = Statement
adapter = New MySqlDataAdapter(SQLStatement, MySQLConnection)
table = New DataTable adapter.Fill(table) gridDataSiswa.DataSource = table Catch ex As Exception MsgBox(ErrorToString) End Try End Sub
Private Sub FrmDataSiswa_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
ExecuteQuery("SELECT NIS, nama as 'Nama', jenkel as 'Jenis Kelamin', tempat_lahir as 'Tempat Lahir',
tanggal_lahir as 'Tanggal Lahir', ortu as 'Nama Orang Tua' FROM siswa")
Me.Refresh() End Sub
Private Sub btnTutup_Click(ByVal sender As
System.Object, ByVal e As System.EventArgs) Handles btnTutup.Click
Me.timerCheck.Enabled = False Me.Dispose()
End Sub
Private Sub btnTambah_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnTambah.Click
FrmTambahSiswa.Show() Me.Close()
End Sub
Private Sub gridDataSiswa_CellContentClick(ByVal sender As System.Object, ByVal e As
System.Windows.Forms.DataGridViewCellEventArgs) Handles gridDataSiswa.CellContentClick
End Sub End Class
Form data guru :
Imports MySql.Data.MySqlClient Public Class FrmGuru
Dim strConnectedDb As String
Dim MySQLConnection As MySqlConnection = New MySqlConnection
Dim adapter As MySqlDataAdapter Dim table As DataTable
Dim SQLStatement As String
Dim ConnectionString As String = "Server=localhost; User Id=root; Database=dbsekolah"
Public Sub ExecuteQuery(ByVal Statement As String) Try MySQLConnection.Close() MySQLConnection.ConnectionString = ConnectionString MySQLConnection.Open() SQLStatement = Statement
adapter = New MySqlDataAdapter(SQLStatement, MySQLConnection)
adapter.Fill(table) GridGuru.DataSource = table Catch ex As Exception MsgBox(ErrorToString) End Try End Sub
Private Sub FrmGuru_Load(ByVal sender As
System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
ExecuteQuery("Select NIK, nama, jenis_kelamin as 'Gender', tempat_lahir as 'Tempat Lahir', tanggal_lahir as 'Tanggal Lahir', jabatan as 'Jabatan', pend_terakhir as 'Jenjang Pendidikan', mapel as 'Mata Pelajaran', status, keterangan, password from guru")
Me.Timercheck.Enabled = True End Sub
Private Sub btAdd_Click(ByVal sender As
System.Object, ByVal e As System.EventArgs) Handles btAdd.Click
FrmTambahGuru.Show() Me.Close()
End Sub
Private Sub btCari_Click(ByVal sender As
System.Object, ByVal e As System.EventArgs) Handles btCari.Click
ExecuteQuery("Select NIK, nama as 'Nama',
pend_terakhir as 'Pendidikan', mapel as 'Mata Pelajaran' from guru where pend_terakhir='" & Me.cbpend.SelectedItem & "'")
End Sub
Private Sub GridGuru_CellContentClick(ByVal sender As System.Object, ByVal e As
System.Windows.Forms.DataGridViewCellEventArgs) Handles GridGuru.CellContentClick
End Sub End Class
Form login admin :
Public Class FrmLoginadmin Dim hitung As Integer
Dim ConnectionString As String = "Server=localhost; User Id=root; Database=dbsekolah"
Dim MySQLConnection As New MySqlConnection Dim MySQLCommand As New MySqlCommand
Dim MySQLDR As MySqlDataReader
Private Sub FrmLoginAdmin_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
hitung = 0
FrmUtama.login = False End Sub
Private Sub btnBatal_Click(ByVal sender As
System.Object, ByVal e As System.EventArgs) Handles btnBatal.Click
Me.Dispose()
FrmUtama.mnuData.Enabled = False End Sub
Private Sub btnLogin_Click(ByVal sender As
System.Object, ByVal e As System.EventArgs) Handles btnLogin.Click
Dim petugas As String = "select * FROM petugas where pass = md5('" & Me.password.Text & "') AND NIK = ('" & Me.nik.Text & "')"
FrmUtama.login = False Try MySQLConnection.Close() MySQLConnection.ConnectionString = ConnectionString MySQLConnection.Open() MySQLCommand.Connection = MySQLConnection MySQLCommand.CommandType = CommandType.Text MySQLCommand.CommandText = petugas Catch ex As Exception
MsgBox("Koneksi database error!", MsgBoxStyle.Critical, "Error!") End Try Try MySQLDR = MySQLCommand.ExecuteReader Dim i As Integer = 0 While MySQLDR.Read i += 1 End While
If i = 0 Then
If hitung = 2 Then
MsgBox("Anda telah gagal Login sebanyak 3 kali!" & vbNewLine & "Aplikasi akan secara otomatis ditutup!", MsgBoxStyle.Critical, "Login gagal") Me.Dispose()
FrmUtama.Close() Else
MsgBox("Login Gagal !! Masukkan NIK dan Password dengan benar!", MsgBoxStyle.Critical, "Login Gagal") Me.nik.Text = "" Me.password.Text = "" Me.nik.Focus() hitung += 1 End If Else
Dim NamaPetugas As String = MySQLDR("nama")
Dim nik As String = MySQLDR("NIK") Dim Admin As String = ""
If (MySQLDR("admin") = "Y") Then Admin = "Administrator"
Else
Admin = "Guru" End If
MsgBox("Informasi Login Anda : " & Chr(13) & "NIK : " & NIK & Chr(13) & "Nama : " &
NamaPetugas & Chr(13) & "Pukul : " & FrmUtama.lblWaktu.Text) Me.Close() FrmUtama.login = True FrmUtama.lblNamaKaryawan.Text = NamaPetugas FrmUtama.lbladmin.Text = Admin FrmUtama.mnuLogin.Enabled = False FrmUtama.mnuLogout.Enabled = True FrmUtama.mnuData.Enabled = True End If Catch ex As Exception MsgBox(ErrorToString) End Try End Sub
Private Sub cancel_Click(ByVal sender As
System.Object, ByVal e As System.EventArgs) Handles cancel.Click
Application.Exit() End Sub
Private Sub grupLogin_Enter(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles grupLogin.Enter
End Sub End Class
Form login siswa :
Imports MySql.Data.MySqlClient Public Class FrmLoginSiswa
Dim ConnectionString As String = "Server=localhost; User Id=root; Database=dbsekolah"
Dim MySQLConnection As New MySqlConnection Dim MySQLCommand As New MySqlCommand
Dim MySQLDR As MySqlDataReader Dim hitung As Integer = 0
Private Sub btnLog_Click(ByVal sender As
System.Object, ByVal e As System.EventArgs) Handles btnLog.Click
Dim siswa As String = "select * FROM siswa where password = md5('" & Me.txtPasswd.Text & "') AND NIS = ('" & Me.txtNIS.Text & "')"
FrmUtama.login = False Try MySQLConnection.Close() MySQLConnection.ConnectionString = ConnectionString MySQLConnection.Open() MySQLCommand.Connection = MySQLConnection MySQLCommand.CommandType = CommandType.Text MySQLCommand.CommandText = siswa Catch ex As Exception
MsgBox("Koneksi database error!", MsgBoxStyle.Critical, "Error!") End Try Try MySQLDR = MySQLCommand.ExecuteReader Dim i As Integer = 0 While MySQLDR.Read i += 1 End While
If i = 0 Then
If hitung = 2 Then
MsgBox("Anda telah gagal Login sebanyak 3 kali!" & vbNewLine & "Aplikasi akan secara otomatis ditutup!", MsgBoxStyle.Critical, "Login gagal") Me.Dispose()
FrmUtama.Close() Else
MsgBox("Login Gagal !! Masukkan NIK dan Password dengan benar!", MsgBoxStyle.Critical, "Login Gagal") Me.txtNIS.Text = "" Me.txtPasswd.Text = "" Me.txtNIS.Focus() hitung += 1 End If Else
Dim NamaSiswa As String = MySQLDR("nama") Dim nis As String = MySQLDR("NIS")
Dim pass As String = MySQLDR("password")
MsgBox("Informasi Login Anda : " & Chr(13) & "NIS : " & nis & Chr(13) & "Nama : " &
NamaSiswa & Chr(13) & "Pukul : " & FrmUtama.lblWaktu.Text) FrmUtama.login = True FrmSiswa.nis = nis FrmSiswa.pass = pass FrmSiswa.Show() Me.Dispose() End If Catch ex As Exception MsgBox(ErrorToString) End Try End Sub
Private Sub FrmLoginSiswa_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
hitung = 0
FrmUtama.login = False End Sub
Private Sub btnCancel_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnCancel.Click
Me.Close()
MenuUtama.Show() End Sub
Form nilai :
Imports MySql.Data.MySqlClient Public Class frmNilai
Dim strConnectedDb As String
Dim MySQLConnection As MySqlConnection = New MySqlConnection
Dim adapter As MySqlDataAdapter Dim table As DataTable
Dim SQLStatement As String
Dim ConnectionString As String = "Server=localhost; User Id=root; Database=dbsekolah"
Public Sub ExecuteQuery(ByVal Statement As String) Try MySQLConnection.Close() MySQLConnection.ConnectionString = ConnectionString MySQLConnection.Open() SQLStatement = Statement
adapter = New MySqlDataAdapter(SQLStatement, MySQLConnection)
table = New DataTable adapter.Fill(table) dataNilai.DataSource = table Catch ex As Exception MsgBox(ErrorToString) End Try End Sub
Private Sub frmNilai_Load(ByVal sender As
System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
ExecuteQuery("Select NIS, sem as 'Semester', nilai_1 as 'Agama', nilai_2 as 'PKN', nilai_3 as 'B. Indonesia', nilai_4 as 'B. Inggris', nilai_5 as
'Matematika', nilai_6 as 'Fisika', nilai_7 as 'Biologi', nilai_8 as 'Kimia', nilai_9 as 'Seni Budaya', nilai_10 as 'Pend. Jasmani', nilai_11 as 'TIK', nilai_12 as
'Kebaharian',rank as 'ranking' From nilai") End Sub
Private Sub btTambah_Click(ByVal sender As
System.Object, ByVal e As System.EventArgs) Handles btTambah.Click
tambahNilai.Show() Me.Dispose()
End Sub
Private Sub dataNilai_CellContentClick(ByVal sender As System.Object, ByVal e As System.Windows.Forms.DataGridViewCellEventArgs) Handles dataNilai.CellContentClick End Sub End Class Form siswa : Imports MySql.Data.MySqlClient Public Class FrmSiswa
Public nis As String Public pass As String
Dim ConnectionString As String = "Server=localhost; User Id=root; Database=dbsekolah"
Dim MySQLConnection As New MySqlConnection Dim MySQLCommand As New MySqlCommand
Dim MySQLDR As MySqlDataReader
Private Sub FrmSiswa_Load(ByVal sender As
System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim siswa As String = "Select * from siswa where NIS = '" & nis & "' and password='" & pass & "'"
MySQLConnection.Close() MySQLConnection.ConnectionString = ConnectionString MySQLConnection.Open() MySQLCommand.Connection = MySQLConnection MySQLCommand.CommandType = CommandType.Text MySQLCommand.CommandText = siswa MySQLDR = MySQLCommand.ExecuteReader While MySQLDR.Read txtNama.Text = MySQLDR("nama") txtnis.Text = MySQLDR("NIS") txtJenkel.Text = MySQLDR("jenkel") txtAgama.Text = MySQLDR("agama") txtTempat.Text = MySQLDR("tempat_lahir") txttgl.Text = MySQLDR("tanggal_lahir") txtortu.Text = MySQLDR("ortu")
txtjur.Text = MySQLDR("kode_jur") txtKel.Text = MySQLDR("kode_kelas") End While
End Sub
Private Sub btNilai_Click(ByVal sender As
System.Object, ByVal e As System.EventArgs) Handles btNilai.Click
Dim cek As String = "Select * from nilai where NIS='" & nis & "' and sem='" & Me.cbSem.SelectedItem & "'" MySQLConnection.Close() MySQLConnection.ConnectionString = ConnectionString MySQLConnection.Open() MySQLCommand.Connection = MySQLConnection MySQLCommand.CommandType = CommandType.Text MySQLCommand.CommandText = cek MySQLDR = MySQLCommand.ExecuteReader Dim i As Integer = 0 While MySQLDR.Read i += 1 End While If i > 0 Then lihatNilai.id = nis lihatNilai.sem = Me.cbSem.SelectedItem lihatNilai.Show() Me.Hide() ElseIf i = 0 Then
MsgBox("Tidak ada data nilai untuk semester ini")
Me.Refresh() End If
End Sub
Private Sub btExit_Click(ByVal sender As
System.Object, ByVal e As System.EventArgs) Handles btExit.Click
Me.Dispose() End Sub
Form tambah guru :
Imports MySql.Data.MySqlClient Public Class FrmTambahGuru
Dim ConnectionString As String = "Server=localhost; User Id=root; Database=dbsekolah"
Dim MySQLConnection As New MySqlConnection Dim MySQLCommand As New MySqlCommand
Dim MySQLDR As MySqlDataReader Private Sub bersih()
Me.txtNIK.Text = "" Me.txtNama.Text = "" Me.txtTempat.Text = "" Me.txtJabatan.Text = "" Me.txtJabatan.Text = "" End Sub
Private Sub FrmTambahGuru_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
bersih() End Sub
Private Sub btSave_Click(ByVal sender As
System.Object, ByVal e As System.EventArgs) Handles btSave.Click Dim x1 = Me.txtNIK.Text Dim x2 = Me.txtNama.Text Dim x3 = Me.cbJenkel.SelectedItem Dim x4 = Me.txtTempat.Text Dim x5 = Me.timepick.Value Dim x6 = Me.txtJabatan.Text Dim x7 = Me.cbPend.SelectedItem Dim x8 = Me.txtMapel.Text Dim x9 = Me.cbStat.SelectedItem Dim x10 = Me.txtKet.Text
Dim cmd As MySqlCommand = New MySqlCommand MySQLConnection.Close() MySQLConnection.ConnectionString = ConnectionString MySQLConnection.Open() MySQLCommand.Connection = MySQLConnection MySQLCommand.CommandType = CommandType.Text
MySQLCommand.CommandText = "select * from guru where NIK='" & Me.txtNIK.Text & "'"
Dim tahun = x5.Year Dim bulan = x5.Month Dim tanggal = x5.Day
MySQLDR = MySQLCommand.ExecuteReader Dim i As Integer = 0 While MySQLDR.Read i += 1 End While If i > 0 Then
MsgBox("NIK sudah ada", MsgBoxStyle.Critical, "Kesalahan")
Me.txtNIK.Text = "" Me.txtNIK.Focus() Else
Try
Dim command As String = "insert into guru values ('" & x1 & "','" & x2 & "','" & x3 & "','" & x4 & "','" & tahun & "-" & bulan & "-" & tanggal & "','" & x6 & "','" & x7 & "','" & x8 & "','" & x9 & "','" & x10 & "',md5('12345'))" MySQLConnection.Close() MySQLConnection.ConnectionString = ConnectionString MySQLConnection.Open() With cmd .CommandText = command .CommandType = CommandType.Text .Connection = MySQLConnection .ExecuteNonQuery() End With
MsgBox("Data baru berhasil ditambahkan", MsgBoxStyle.Information, "Simpan")
FrmGuru.Show() Me.Dispose()
Catch ex As Exception
MsgBox("Data tidak Berhasil ditambah", MsgBoxStyle.Exclamation, "Gagal")
bersih() End Try
End If End Sub
Private Sub btExit_Click(ByVal sender As
System.Object, ByVal e As System.EventArgs) Handles btExit.Click
FrmGuru.Show() Me.Dispose() End Sub
End Class
Form tambah siswa :
Imports MySql.Data.MySqlClient Public Class FrmTambahSiswa
Dim ConnectionString As String = "Server=localhost; User Id=root; Database=dbsekolah"
Dim MySQLConnection As New MySqlConnection Dim MySQLCommand As New MySqlCommand
Dim MySQLDR As MySqlDataReader
Private Sub kosong()
Me.nisSiswa.Text = "" Me.namaSiswa.Text = "" Me.txtTempat.Text = "" Me.txtOrtu.Text = "" End Sub
Private Sub FrmTambahSiswa_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
kosong() End Sub
Private Sub btnBatal_Click(ByVal sender As
System.Object, ByVal e As System.EventArgs) Handles btnBatal.Click
FrmDatasiswa.Enabled = True
FrmDatasiswa.ExecuteQuery("SELECT NIS, nama as 'Nama', jenkel as 'Jenis Kelamin', tempat_lahir as
'Tempat Lahir', tanggal_lahir as 'Tanggal Lahir', ortu as 'Nama Orang Tua' FROM siswa")
FrmDatasiswa.timerCheck.Enabled = True FrmDatasiswa.Show()
Me.Dispose() End Sub
Private Sub btnSimpan_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnSimpan.Click
Dim n1 = Me.nisSiswa.Text Dim n2 = Me.namaSiswa.Text
Dim n3 = Me.cboJenKel.SelectedItem Dim n4 = Me.cbAgama.SelectedItem Dim n5 = Me.txtTempat.Text Dim n6 = Me.timePick.Value Dim n7 = Me.txtOrtu.Text Dim n8 = Me.cbJur.SelectedItem Dim n9 = Me.cbKel.SelectedItem
Dim cmd As MySqlCommand = New MySqlCommand MySQLConnection.Close() MySQLConnection.ConnectionString = ConnectionString MySQLConnection.Open() MySQLCommand.Connection = MySQLConnection MySQLCommand.CommandType = CommandType.Text MySQLCommand.CommandText = "Select * From siswa Where NIS = '" & n1 & "'"
Dim tahun = n6.Year Dim bulan = n6.Month Dim tanggal = n6.Day Try MySQLDR = MySQLCommand.ExecuteReader Dim i As Integer = 0 While MySQLDR.Read i += 1 End While If n1 = "" Then
MsgBox("Isikan NIS dengan benar", MsgBoxStyle.Exclamation, "Gagal")
Me.nisSiswa.Focus() ElseIf n2 = "" Then
MsgBox("Isikan Nama dengan Benar", MsgBoxStyle.Exclamation, "Gagal")
Me.namaSiswa.Focus() ElseIf n7 = "" Then
MsgBox("Isikan Nama Orang Tua dengan Benar", MsgBoxStyle.Exclamation, "Gagal")
Me.txtOrtu.Focus() ElseIf i = 0 Then
Try
Dim Command As String = "INSERT INTO siswa VALUES ('" & n1 & "','" & n2 & "','" & n3 & "','" & n4 & "','" & n5 & "','" & tahun & "-" & bulan & "-" & tanggal & "','" & n7 & "','" & n8 & "','" & n9 &
MySQLConnection.Close() MySQLConnection.ConnectionString = ConnectionString MySQLConnection.Open() With cmd .CommandText = Command .CommandType = CommandType.Text .Connection = MySQLConnection .ExecuteNonQuery() End With
MsgBox("Data baru berhasil ditambahkan", MsgBoxStyle.Information, "Simpan") FrmDatasiswa.Show()
Me.Close()
Catch ex As Exception
MsgBox("Data tidak Berhasil ditambah", MsgBoxStyle.Exclamation, "Gagal") kosong()
End Try Else
MsgBox("NIS sudah ada", MsgBoxStyle.Critical, "Kesalahan") Me.nisSiswa.Text = "" Me.nisSiswa.Focus() End If Catch ex As Exception End Try End Sub
Private Sub grupData_Enter(ByVal sender As
System.Object, ByVal e As System.EventArgs) Handles grupData.Enter
End Sub End Class
Form utama :
Imports MySql.Data.MySqlClient Public Class FrmUtama
Dim form, teks As String Public login As Boolean
Dim MySQLConnection As MySqlConnection = New MySqlConnection
Dim adapter As MySqlDataAdapter Dim table As DataTable
Dim ConnectionString As String = "Server=localhost; User Id=root; Database=dbsekolah"
Public Sub Connect()
MySQLConnection.ConnectionString = ConnectionString
Try
MySQLConnection.Open() Catch ex As Exception
MsgBox("Koneksi ke Database gagal!!", MsgBoxStyle.Critical, "Error Message")
End Try End Sub
Public Sub disConnect() MySQLConnection.Close() End Sub
Private Sub bukaForm(ByVal jendela As Form) jendela.MdiParent = Me jendela.Show() teks = jendela.Text Me.lblFormAktif.Text = teks form = jendela.Name End Sub
Private Sub FrmUtama_Load(ByVal sender As
System.Object, ByVal e As System.EventArgs) Handles MyBase.Load login = False mnuLogin.PerformClick() If MySQLConnection.State = ConnectionState.Closed Then Connect() End If End Sub
Private Sub mnuExit_Click(ByVal sender As
System.Object, ByVal e As System.EventArgs) Handles mnuExit.Click
Dim konfirmasi
If MdiChildren.Any Then
MsgBox("Form " & Me.lblFormAktif.Text & " sedang aktif. Tutup dahulu untuk keluar!",
MsgBoxStyle.Exclamation, "Ada form yang sedang aktif") Else
konfirmasi = MsgBox("Apakah anda yakin ingin menutup Aplikasi ini?", MsgBoxStyle.YesNo, "Konfirmasi") If (konfirmasi = vbYes) Then
End If End If End Sub
Private Sub Check_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Check.Tick
Dim dtk, detik detik = Now.Second If detik < 10 Then dtk = "0" & detik.ToString Else dtk = detik End If Dim mnt, menit menit = Now.Minute If menit < 10 Then mnt = "0" & menit.ToString Else mnt = menit End If Dim jam, jm jm = Now.Hour If jm < 10 Then
jam = "0" & jm.ToString Else jam = jm End If Dim tgl, tanggal tanggal = Now.Day If tanggal < 10 Then tgl = "0" & tanggal.ToString Else tgl = tanggal End If Dim bln = Now.Month Dim thn = Now.Year
Dim bulan() As String = {"Januari", "Februari", "Maret", "April", "Mei", "Juni", "Juli", "Agustus", "September", "Oktober", "November", "Desember"}
Me.lblWaktu.Text = jam & ":" & mnt & ":" & dtk Me.lblTanggal.Text = tgl & " " & bulan(bln - 1) & " " & thn If MySqlConnection.State = ConnectionState.Open Then Me.ConnectToolStripMenuItem.Enabled = False Me.DisconnectToolStripMenuItem.Enabled = True Me.statuskoneksi.Text = "Terhubung ke Database" Me.statuskoneksi.ForeColor = Color.Green
End If If MySQLConnection.State = ConnectionState.Closed Then Me.ConnectToolStripMenuItem.Enabled = True Me.DisconnectToolStripMenuItem.Enabled = False
Me.statuskoneksi.Text = "Tidak Terhubung ke Database"
Me.statuskoneksi.ForeColor = Color.Red Me.mnuData.Enabled = False
End If End Sub
Private Sub MdiAktif_Tick(ByVal sender As
System.Object, ByVal e As System.EventArgs) Handles MdiAktif.Tick
On Error Resume Next If login = False Then
mnuTutup.Enabled = False
Me.lblNamaKaryawan.Text = "Belum Login" Me.lblFormAktif.Text = "Tampilan Awal" Me.lbladmin.Text = "Tidak Diketahui" End If If (MdiChildren.Any) Then mnuTutup.Enabled = True lblFormAktif.Text = ActiveMdiChild.Text ActiveMdiChild.ShowInTaskbar = False Else lblFormAktif.Text = Me.Text Me.mnuTutup.Enabled = False End If End Sub
Private Sub mnuLogin_Click(ByVal sender As
System.Object, ByVal e As System.EventArgs) Handles mnuLogin.Click
bukaForm(FrmLoginadmin) End Sub
Private Sub mnuLogout_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles mnuLogout.Click
If MdiChildren.Any Then
MsgBox("Form " & Me.lblFormAktif.Text & " sedang aktif. Tutup dahulu untuk Logout!",
MsgBoxStyle.Exclamation, "Ada form yang sedang aktif") Else
Me.mnuLogin.Enabled = True Me.mnuLogout.Enabled = False
login = False
Me.mnuData.Enabled = False End If
FrmLoginadmin.Show() End Sub
Private Sub mnuTutup_Click(ByVal sender As
System.Object, ByVal e As System.EventArgs) Handles mnuTutup.Click If MdiChildren.Any Then lblFormAktif.Text = ActiveMdiChild.Text Else lblFormAktif.Text = Me.Text End If End Sub
Private Sub mnuDataSiswa_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles mnuDataSiswa.Click
bukaForm(FrmDatasiswa)
FrmDatasiswa.timerCheck.Enabled = True End Sub
Private Sub mnuDataGuru_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles mnuDataGuru.Click
bukaForm(FrmGuru)
FrmGuru.Timercheck.Enabled = True End Sub
Private Sub DisconnectToolStripMenuItem_Click_1(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles DisconnectToolStripMenuItem.Click
disConnect() End Sub
Private Sub ConnectToolStripMenuItem_Click_1(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ConnectToolStripMenuItem.Click
Connect() End Sub
Private Sub DataNilaiToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles DataNilaiToolStripMenuItem.Click
bukaForm(frmNilai) End Sub
Lihat nilai :
Imports MySql.Data.MySqlClient Public Class lihatNilai
Public id As String Public sem As String
Dim ConnectionString As String = "Server=localhost; User Id=root; Database=dbsekolah"
Dim MySQLConnection As New MySqlConnection Dim MySQLCommand As New MySqlCommand
Dim MySQLDR As MySqlDataReader
Private Sub lihatNilai_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
MsgBox("Semoga Nilai Anda Memuaskan")
Dim nilai As String = "Select s.NIS, s.nama, n.nilai_1, n.nilai_2, n.nilai_3, n.nilai_4, n.nilai_5, n.nilai_6, n.nilai_7, n.nilai_8, n.nilai_9, n.nilai_10, n.nilai_11, n.nilai_12, n.rank From nilai as n , siswa as