Public Class ReturnForm

    Private Enum ReturnList
        ProdSN
        ReturnCount
        ReturnDate
        ReturnTime
        RegDate
        RegTime
        MaxList
    End Enum
    Private ReturnData(ReturnList.MaxList - 1) As String

    Private Sub ReturnForm_Load(sender As Object, e As EventArgs) Handles MyBase.Load
        Const RowCount As Int16 = ReturnList.MaxList - 1
        Dim DBCmd As String = String.Empty
        Dim SerialName As String = mainForm.txbProdSerial.Text
        Dim DataCount As Int16 = 0
        Dim MaxData As Int16 = 0

        dgvReturn.Rows.Clear()

        DBCmd = "SELECT Product_SN,ReturnCount,IFNULL(ReturnDate,'N/A'),IFNULL(ReturnTime,'N/A'),IFNULL(DataRegDate,'N/A'),IFNULL(DataRegTime,'N/A') FROM " & ApplyReturnDB & " WHERE Product_SN = '" & SerialName & "'"

        If DBQueryReader(DBCmd) Then
            For i = 0 To sqlDataQuery.Length - 1
                ReturnData(DataCount) = sqlDataQuery(i)

                DataCount += 1

                If (i Mod ReturnList.MaxList) = RowCount Then
                    dgvReturn.Rows.Add(ReturnData)
                    ReDim ReturnData(RowCount)
                    DataCount = 0
                End If
            Next

        Else
            MsgBox("반품 데이터를 불러오는 도중 오류가 발생하였습니다.", vbCritical)
            Me.Close()
        End If
    End Sub
End Class