Sub Displaydata()
Try
objDataTable.Clear()
strSQL = "Select * from Barang Order by Kode_Brg asc"
objCommand = New OleDbCommand
objCommand.Connection = MyConnection.open
objCommand.CommandType = CommandType.Text
objCommand.CommandText = strSQL
objDataAdapter = New OleDbDataAdapter(objCommand)
objDataAdapter.Fill(objDataSet, "MDT_Barang")
MyConnection.close()
objDataTable = objDataSet.Tables("MDT_Barang")
Catch ex As Exception
MsgBox("Program error" _
& vbCrLf & Err.Description)
MyConnection.close()
End Try
End Sub
Sub ViewData()
Dim hrg_beli, hrg_jual As Double
objCommand = MyConnection.open.CreateCommand
objCommand.CommandText = "select * from Barang Where Kode_Brg = '" & Trim(txtKode_Brg.Text) & "';"
objdatareader = objCommand.ExecuteReader
objdatareader.Read()
txtKode_Brg.Text = objdatareader.Item("Kode_Brg")
txtDeskripsi.Text = objdatareader.Item("Deskripsi").ToString
txtPhoto.Text = objdatareader.Item("Path").ToString
txtStok.Text = objdatareader.Item("Stok").ToString
hrg_beli = objdatareader.Item("Hrg_Beli").ToString
hrg_jual = objdatareader.Item("Hrg_Jual").ToString
txtMinimum.Text = objdatareader.Item("Minimum").ToString
MyConnection.close()
txtHrg_Beli.Text = FormatCurrency(hrg_beli)
txtHrg_Jual.Text = FormatCurrency(hrg_jual)
If Trim(txtPhoto.Text) <> "" Then
PbPhoto.Image = PbPhoto.Image.FromFile(txtPhoto.Text)
End If
End Sub
Sub CekData()
objDataTable.Clear()
strSQL = "Select * from Barang Where Kode_Brg " & _
" = '" & Trim(txtKode_Brg.Text) + "'"
objCommand = New OleDbCommand
objCommand.Connection = MyConnection.open
objCommand.CommandType = CommandType.Text
objCommand.CommandText = strSQL
objDataAdapter = New OleDbDataAdapter(objCommand)
objDataAdapter.Fill(objDataSet, "MDT_Barang")
MyConnection.close()
objDataTable = objDataSet.Tables("MDT_Barang")
End Sub
Sub Navigator()
Try
Dim hrg_beli, hrg_jual As Double
Dim i As Integer
strSQL = "Select * from Barang Order by Kode_Brg asc"
objCommand = New OleDbCommand
objCommand.Connection = MyConnection.open
objCommand.CommandType = CommandType.Text
objCommand.CommandText = strSQL
objDataAdapter = New OleDbDataAdapter(objCommand)
objDataAdapter.Fill(objDataSet, "MDT_Barang")
MyConnection.close()
objDataTable = objDataSet.Tables("MDT_Barang")
mPosition = BindingContext(objDataTable).Position
With objDataTable.Rows(mPosition)
txtKode_Brg.Text = .Item("Kode_Brg")
txtDeskripsi.Text = .Item("Deskripsi").ToString
txtPhoto.Text = .Item("Path").ToString
txtStok.Text = .Item("Stok").ToString
hrg_beli = .Item("Hrg_Beli").ToString
hrg_jual = .Item("Hrg_Jual").ToString
txtMinimum.Text = .Item("Minimum").ToString
End With
txtHrg_Beli.Text = FormatCurrency(hrg_beli)
txtHrg_Jual.Text = FormatCurrency(hrg_jual)
If Trim(txtPhoto.Text) <> "" Then
PbPhoto.Image = PbPhoto.Image.FromFile(txtPhoto.Text)
End If
Catch When Err.Number <> 0
MsgBox("Program error" _
& vbCrLf & Err.Description)
MyConnection.close()
End Try
End Sub
Try
objDataTable.Clear()
strSQL = "Select * from Barang Order by Kode_Brg asc"
objCommand = New OleDbCommand
objCommand.Connection = MyConnection.open
objCommand.CommandType = CommandType.Text
objCommand.CommandText = strSQL
objDataAdapter = New OleDbDataAdapter(objCommand)
objDataAdapter.Fill(objDataSet, "MDT_Barang")
MyConnection.close()
objDataTable = objDataSet.Tables("MDT_Barang")
Catch ex As Exception
MsgBox("Program error" _
& vbCrLf & Err.Description)
MyConnection.close()
End Try
End Sub
Sub ViewData()
Dim hrg_beli, hrg_jual As Double
objCommand = MyConnection.open.CreateCommand
objCommand.CommandText = "select * from Barang Where Kode_Brg = '" & Trim(txtKode_Brg.Text) & "';"
objdatareader = objCommand.ExecuteReader
objdatareader.Read()
txtKode_Brg.Text = objdatareader.Item("Kode_Brg")
txtDeskripsi.Text = objdatareader.Item("Deskripsi").ToString
txtPhoto.Text = objdatareader.Item("Path").ToString
txtStok.Text = objdatareader.Item("Stok").ToString
hrg_beli = objdatareader.Item("Hrg_Beli").ToString
hrg_jual = objdatareader.Item("Hrg_Jual").ToString
txtMinimum.Text = objdatareader.Item("Minimum").ToString
MyConnection.close()
txtHrg_Beli.Text = FormatCurrency(hrg_beli)
txtHrg_Jual.Text = FormatCurrency(hrg_jual)
If Trim(txtPhoto.Text) <> "" Then
PbPhoto.Image = PbPhoto.Image.FromFile(txtPhoto.Text)
End If
End Sub
Sub CekData()
objDataTable.Clear()
strSQL = "Select * from Barang Where Kode_Brg " & _
" = '" & Trim(txtKode_Brg.Text) + "'"
objCommand = New OleDbCommand
objCommand.Connection = MyConnection.open
objCommand.CommandType = CommandType.Text
objCommand.CommandText = strSQL
objDataAdapter = New OleDbDataAdapter(objCommand)
objDataAdapter.Fill(objDataSet, "MDT_Barang")
MyConnection.close()
objDataTable = objDataSet.Tables("MDT_Barang")
End Sub
Sub Navigator()
Try
Dim hrg_beli, hrg_jual As Double
Dim i As Integer
strSQL = "Select * from Barang Order by Kode_Brg asc"
objCommand = New OleDbCommand
objCommand.Connection = MyConnection.open
objCommand.CommandType = CommandType.Text
objCommand.CommandText = strSQL
objDataAdapter = New OleDbDataAdapter(objCommand)
objDataAdapter.Fill(objDataSet, "MDT_Barang")
MyConnection.close()
objDataTable = objDataSet.Tables("MDT_Barang")
mPosition = BindingContext(objDataTable).Position
With objDataTable.Rows(mPosition)
txtKode_Brg.Text = .Item("Kode_Brg")
txtDeskripsi.Text = .Item("Deskripsi").ToString
txtPhoto.Text = .Item("Path").ToString
txtStok.Text = .Item("Stok").ToString
hrg_beli = .Item("Hrg_Beli").ToString
hrg_jual = .Item("Hrg_Jual").ToString
txtMinimum.Text = .Item("Minimum").ToString
End With
txtHrg_Beli.Text = FormatCurrency(hrg_beli)
txtHrg_Jual.Text = FormatCurrency(hrg_jual)
If Trim(txtPhoto.Text) <> "" Then
PbPhoto.Image = PbPhoto.Image.FromFile(txtPhoto.Text)
End If
Catch When Err.Number <> 0
MsgBox("Program error" _
& vbCrLf & Err.Description)
MyConnection.close()
End Try
End Sub