Imports System.Data.Sql
Imports System.Data.SqlClient
Public Class frm_ReportQA
Friend cn As New SqlConnection("Data Source=HQ-IT-IT03;Initial Catalog=parameterproject; Integrated Security=SSPI;")
Friend cmd As New SqlCommand
Friend DA As New SqlDataAdapter
Friend Sql As String
Friend Ds As DataSet
Friend DR As SqlDataReader
Friend DT As New DataTable
Private Sub frm_ReportQA_Load(sender As Object, e As EventArgs) Handles MyBase.Load
Dim sql As String = "SELECT Actual_FM,Actual_Name FROM MeasurableForming"
Dim cmd As SqlCommand = New SqlCommand(sql, cn)
Dim DR As SqlDataReader = cmd.ExecuteReader
DR.Read()
ListViewQA.Columns.Add("Actual_FM", 80, HorizontalAlignment.Center)
ListViewQA.Columns.Add("Actual_FM", 250, HorizontalAlignment.Center)
DT = New DataTable
DT.Load(DR)
Dim row As DataRow
ListViewQA.Items.Clear()
For Each row In DT.Rows
Dim li As New ListViewItem
li.Text = CType(row("Actual_FM"), String)
li.SubItems.Add(CType(row("Actual_FM"), String))
ListViewQA.Items.Add(li)
li = Nothing
Next
DR.Close()
End Sub
End Class
Private Sub Loadlistname()
ListViewQA.Items.Clear()
cmd.CommandText = "select * from MeasurableForming"
cmd.Connection = cn
cn.Open()
Dim rs As SqlDataReader = cmd.ExecuteReader
While rs.Read
Dim mylist As ListViewItem = New ListViewItem
mylist.Text = rs.GetString(0)
mylist.SubItems.Add(rs.GetString(1))
mylist.SubItems.Add(rs.GetString(6))
'mylist.SubItems.Add(rs.GetString(15))
'mylist.SubItems.Add(rs.GetString(34))
'mylist.SubItems.Add(rs.GetString(36))
'mylist.SubItems.Add(rs.GetString(37))
'mylist.SubItems.Add(rs.GetString(38))
'mylist.SubItems.Add(rs.GetString(39))
'mylist.SubItems.Add(rs.GetString(40))
'mylist.SubItems.Add(rs.GetString(35))
ListViewQA.Items.Add(mylist)
End While
rs.Close()
cn.Close()
End Sub
Public drCancel_ As New DataTable
Public AddListView(4) As String
Public item As ListViewItem
'' LOADHEADER
Sub LOADHEADER()
lvwscore.Columns.Clear()
lvwscore.Items.Clear()
lvwscore.FullRowSelect = True
lvwscore.View = View.Details
lvwscore.Columns.Add("RCNO", 110, HorizontalAlignment.Left)
lvwscore.Columns.Add("SEQ", 55, HorizontalAlignment.Left)
lvwscore.Columns.Add("PARTNO", 105, HorizontalAlignment.Left)
lvwscore.Columns.Add("QTY", 50, HorizontalAlignment.Left)
End Sub
'' เก็บค่า RVMANAGINGNO,LABELSEQ ใน DATATABLE
Sub ADD_DATAROWS(ByVal barcode_ As String)
Dim sql As String
sql = "SELECT RVMANAGINGNO,LABELSEQ,PARTNO,RECEIVINGQUANTITY from TBT_CARTONDETAILS where palletkey='" & Trim(barcode_) & "'"
drCancel_ = ssCON.Exc_Reader(sql)
End Sub
''ADD_LISTVIEW --
Sub ADD_LISTVIEW()
Dim DS As DataSet = New DataSet("Table")
Dim Table As New Data.DataTable
Table.Columns.Add("TABLE1_")
If drCancel_.Rows.Count > 0 Then
For i As Integer = 0 To drCancel_.Rows.Count - 1
AddListView(0) = drCancel_.Rows(i)("RVMANAGINGNO").ToString
AddListView(1) = drCancel_.Rows(i)("LABELSEQ").ToString
AddListView(2) = drCancel_.Rows(i)("PARTNO").ToString
AddListView(3) = drCancel_.Rows(i)("RECEIVINGQUANTITY").ToString
item = New ListViewItem(AddListView)
lvwscore.Items.Add(item)
Next
lvwscore.Refresh()
End If
End Sub