0% found this document useful (0 votes)
11 views3 pages

ODBC Connection and Ticket System

Uploaded by

alfatihahtulaura
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
11 views3 pages

ODBC Connection and Ticket System

Uploaded by

alfatihahtulaura
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd

Modul

Imports [Link]
Module Module1

Public cn As OdbcConnection
Public da As OdbcDataAdapter
Public dr As OdbcDataReader
Public dt As DataTable

Sub koneksi()
Dim db_name, db_server, db_port, db_user, db_pass As String

db_name = "db_penumpang"
db_server = "localhost"
db_port = "3306"
db_user = "root"
db_pass = ""

Try
'mecoba untuk menkoneksikan'
Dim str As String
str = "DRIVER ={Mysql ODBC 3.51 Driver};SERVER=" & db_server & "; DATABASE =
" & db_name & ";UID = " & db_user & ";PWD =" & db_pass & ";PORT=" & db_port & ";OPTION=3"
cn = New OdbcConnection(str)
If [Link] = [Link] Then
[Link]()

End If
'jika koneksi gagal'
MsgBox("koneksi eror", [Link], "info")
End
Catch ex As Exception

End Try
End Sub
End Module

combo

Private Sub cmbnotiket_SelectedIndexChanged(ByVal sender As [Link], ByVal e As


[Link]) Handles [Link]
Select Case [Link]
Case "TK01" : [Link] = "attalah"
Case "TK02" : [Link] = "alexa"
Case "TK03" : [Link] = "akilla"
Case "TK04" : [Link] = "aluna"

Case Else
[Link] = ""
End Select
Imports [Link]
Public Class Form1
Sub tampilgrid()
Call koneksi()
da = New OdbcConnection("select * from tb_admin", con)
dt = New DataTable
[Link](dt)
[Link] = dt

'mengatur judul
[Link](0).HeaderText = "NO TIKET"
[Link](1).HeaderText = "NAMA"
[Link](2).HeaderText = "JUMLAH"
[Link](3).HeaderText = "NAMA MASKAPAI"
[Link](4).HeaderText = "TANGGAL"
[Link](5).HeaderText = "HARGA"
[Link](6).HeaderText = "BAYAR"

'mengatur lebar kolom


[Link](0).Width = 80
[Link](1).Width = 100
[Link](2).Width = 100
[Link](3).Width = 100
[Link](4).Width = 100
[Link](5).Width = 100
[Link](6).Width = 100

Private Sub Form1_Load(ByVal sender As [Link], ByVal e As [Link])


Handles [Link]

[Link] = ("-----pilih nomor tiket-----")


[Link]("TK01")
[Link]("TK02")
[Link]("TK03")
[Link]("TK04")

Call koneksi()
Call tampilgrid()

Hitung

If [Link] = "garuda" Then


[Link] = 1800000
Else
If [Link] = "lion" Then
[Link] = 1500000
Else
If [Link] = "sriwijaya" Then
[Link] = 1750000

Else
[Link] = 0
End If
End If
End If

Dim bayr As Integer


If [Link] <= 5 Then
[Link] = 0
bayr = Val([Link] * [Link])
[Link] = bayr
End If

You might also like