Prosedure Tampil
#Region "tampil"
Sub tampil(ByVal str As String)
Try
objcommand = New OleDbCommand
("select * from [db_scrapt] where wono = " & str & "")
objcommand.Connection = mykoneksi.open objdataadapter = New OleDbDataAdapter(objcommand)
objdataadapter.Fill(objdataset, "brand") objdatatable = objdataset.Tables("brand") mykoneksi.close()
Catch ex As Exception
MsgBox("konek ke database gagal" & ex.Message)
mykoneksi.close()
End Try
End Sub
#End Region
Tombol Cari
Button Cari :
#Region "cari_data_input_scrapt"
#Region "cari_data_input_scrapt"
Private Sub btncari_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btncari.Click
objdatatable.Clear()
ListView1.Refresh()
ListView1.Items.Clear()
If rbwo.Checked = False And rbprod.Checked = False And rbdept.Checked = False Then MsgBox("Pilih dasar pencarian", MsgBoxStyle.Exclamation, "Informasi")
ElseIf rbdept.Checked = True And rbprod.Checked = False And rbwo.Checked = False Then
Try
cari(txtcari.Text, "depsend")
Catch ex As Exception
MsgBox("konek ke database gagal" & ex.Message)
mykoneksi.close()
End Try
ElseIf rbdept.Checked = False And rbprod.Checked = True And rbwo.Checked = False Then
Try
cariprod(txtcari.Text, "prodno")
Catch ex As Exception
MsgBox("konek ke database gagal" & ex.Message)
mykoneksi.close()
End Try
ElseIf rbdept.Checked = False And rbprod.Checked = False And rbwo.Checked = True Then Dim s1 As String = txtcari.Text
Dim s2 As Double = Integer.Parse(s1)
Try
objcommand = New OleDbCommand("select * from [db_scrapt] where wono = " & s2 & "") objcommand.Connection = mykoneksi.open
objdataadapter = New OleDbDataAdapter(objcommand)
objdataadapter.Fill(objdataset, "brand")
objdatatable = objdataset.Tables("brand")
objdatareaer = objcommand.ExecuteReader
For I = 0 To objdatatable.Rows.Count - 1
objdatareaer.Read()
Dim tgl As Date = CDate(objdatareaer.Item(4))
With ListView1.Items.Add(objdatareaer.Item(0))
.SubItems.Add(objdatareaer.Item(1))
.SubItems.Add(objdatareaer.Item(2))
.SubItems.Add(objdatareaer.Item(3))
.SubItems.Add(tgl.ToShortDateString)
'.SubItems.Add(objdatareaer.Item(4))
.SubItems.Add(objdatareaer.Item(5))
.SubItems.Add(objdatareaer.Item(6))
.SubItems.Add(objdatareaer.Item(7))
.SubItems.Add(objdatareaer.Item(8))
.SubItems.Add(objdatareaer.Item(9))
.SubItems.Add(objdatareaer.Item(10))
.SubItems.Add(objdatareaer.Item(11))
.SubItems.Add(objdatareaer.Item(12))
.SubItems.Add(objdatareaer.Item(13))
.SubItems.Add(objdatareaer.Item(14))
End With
Next I
mykoneksi.close()
Catch ex As Exception
MsgBox("konek ke database gagal" & ex.Message)
mykoneksi.close()
End Try
End If
Button1.Enabled = True
End Sub
#End Region
Program Di Load
#Region "load program"
Private Sub binputscrapt_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
'contoh()
txtwo.Enabled = False
txtwo1.Text = "WO"
txtwo1.ReadOnly = True
txtitem.Enabled = False
txtprod.Enabled = False
txtdesc.Enabled = False
txtmodel.Enabled = False
txtcolor.Enabled = False
txtsize.Enabled = False
txtcollec.Enabled = False
txtqty.Enabled = False
txtdate.Enabled = False
cbprioritas.Enabled = False
cbdepcause.Enabled = False
txttotal.Enabled = False
txttotal.Enabled = False
txtdestroy.Enabled = False
txtsf.Enabled = False
txtinstan.Enabled = False
txtqa.Enabled = False
txtother.Enabled = False
cbdepcause.Enabled = False
txtremark.Enabled = False
cbdept.Enabled = False
btnadd.Enabled = True
End Sub
#End Region

0 komentar:
Posting Komentar