Contoh Data Base Penerbangan Menggunakan Visual Basic (VB)

11
 1 DATA PENERBANGAN FKIP TIK_3 PBO2 A.  DATA BASE PENERBANGAN B. KONEK KE DATA BASE Klik start - control panel - large icon –  ODBC –  dBASE File- add  –  mySQL ODBC 3.51 Driver  –  Finis

description

PBO2

Transcript of Contoh Data Base Penerbangan Menggunakan Visual Basic (VB)

DATA PENERBANGAN FKIP TIK_3 PBO2

A. DATA BASE PENERBANGAN

B. KONEK KE DATA BASEKlik start - control panel - large icon ODBC dBASE File- add mySQL ODBC 3.51 Driver Finis

C. FORM-FORM YANG ADA

1. Form Menu

2. Form Pemesanan Tiket

3. Form Laporan Keseluruhan Pemesanan Tiket

D. HASIL LAPORAN CRYSTAL REPORT

Design

Preview

E. KETERANGAN DARI FORM-FORM YANG ADA1. ModulPublic con As New ADODB.ConnectionPublic constr As StringPublic rs As New ADODB.RecordsetPublic status

Public Sub connect()con.ConnectionString = "Provider=MSDASQL.1;Persist Security Info=False;Data Source=penerbangan"con.OpenEnd Sub2. Form Pemesanan Tiketa. Script Load AdodcPrivate Sub Form_Load()If con.State = adStateClosed ThenconnectEnd IfAdodc1.ConnectionString = "Provider=MSDASQL.1;Persist Security Info=False;Data Source=penerbangan"End Subb. Script KosongPrivate Sub kosong()Text1.Text = " "Text2.Text = " "Combo1.Text = " "Text3.Text = " "Text4.Text = " "Text5.Text = " "DTPicker = " "End Subc. Script ComboPrivate Sub Combo1_click()If Combo1.Text = "GA1265" ThenText2.Text = "GARUDA INDONESIA"Text3.Text = "MEDAN"Text4.Text = "450000"Text5.Text = "3"ElseIf Combo1.Text = "JT3642" ThenText2.Text = "LION AIR"Text3.Text = "JAKARTA"Text4.Text = "660000"Text5.Text = "3"ElseIf Combo1.Text = "SJ1266" ThenText2.Text = "SRIWIJAYA AIR"Text3.Text = "JAKARTA"Text4.Text = "600000"Text5.Text = "4"ElseIf Combo1.Text = "QG4522" ThenText2.Text = "CITYLINE"Text3.Text = "BATAM"Text4.Text = "500000"Text5.Text = "5"ElseEnd IfEnd IfEnd IfEnd IfEnd Sub

d. Script SimpanPrivate Sub Command1_Click()con.Execute (" insert into penerbangan values('" & Text1 & "','" & Combo1 & "', '" & Text2 & "', '" & Text3 & "', '" & Text4 & "', '" & Text5 & "','" & Format(DTPicker1, "yyyy-mm-dd") & "')")kosongMsgBox ("DATA SUDAH TERSIMPAN")Text1.SetFocusEnd Sub

e. Script UpdatePrivate Sub Command2_Click()con.Execute (" update penerbangan set kd_pswt='" & Combo1 & "', nm_pswt='" & Text2 & "', tujuan='" & Text3 & "', harga='" & Text4 & "', jumlah='" & Text5 & "', tgl_pesan='" & Format(DTPicker1, "yyyy-mm-dd") & "'where kd_pesan='" & Trim(Text1.Text) & "' ")kosongMsgBox ("Data berhasil di update")Text1.SetFocusEnd Sub

f. Script HapusPrivate Sub Command3_Click()Dim X As StringX = MsgBox(" Ingin hapus data ini?[Y/N]", vbYesNo + vbQuestion) If X = vbYes Then con.Execute (" delete from penerbangan where kd_pesan='" & Trim(Text1) & "'") End IfkosongText1.SetFocusEnd Sub

g. Script CancelPrivate Sub Command4_Click()kosongEnd Sub

h. Script ExitPrivate Sub Command5_Click()X = MsgBox("Apakah Anda Yakin Menutup Program Ini ?", _ vbYesNo + vbQuestion, "Konfirmasi") If X = vbYes Then Unload Me End IfEnd Sub

3. Form Laporan Keseluruhan Pemesanan Tiketa. Script Form LoadPrivate Sub Form_Load()If con.State = adStateClosed ThenconnectEnd IfEnd Subb. Script PreviewPrivate Sub Command1_Click()Dim pass As String, b As Stringpass = "Provider=MSDASQL.1;Persist Security Info=False;Data Source=penerbangan"Cr.connect = passCr.ReportFileName = App.Path & "\report1.rpt"Cr.WindowState = crptMaximizedCr.Formulas(0) = "kepala='" & Text1.Text & "'"Cr.RetrieveDataFilesCr.Action = 1End Sub

Hasil Preview

c. Script CancelPrivate Sub kosong()Text1.Text = " "End Subd. Script ExitPrivate Sub Command3_Click()Unload MeEnd Sub

4. Form Menu Utamaa. Script Form Input DataPrivate Sub idpt_Click()Form1.ShowEnd Sub

b. Script Form LaporanPrivate Sub lkpt_Click()Form2.ShowEnd Sub

c. Script Form ExitPrivate Sub E_Click()X = MsgBox("apakah anda yakin menutup program ini?", _vbYesNo + vbQuestion, "konfirmasi")If X = vbYes ThenUnload MeEnd IfEnd Sub

5