Imports System
Imports System.Data
Imports System.Data.SqlClient
Imports System.IO
Imports System.Security
Imports System.Security.Cryptography
Imports System.Text
Public Class PCB
    Private _serialno As String
    Private _lastupdate As DateTime
    Private _lastupdatedby As String
    Private cnstr As String


    Public Property serialno() As String
        Get
            Return _serialno
        End Get
        Set(ByVal value As String)
            _serialno = value
        End Set
    End Property

    Public Property lastupdate() As DateTime
        Get
            Return _lastupdate
        End Get
        Set(ByVal value As DateTime)
            _lastupdatedby = value
        End Set
    End Property

    Public Property lastupdatedby() As String
        Get
            Return _lastupdatedby
        End Get
        Set(ByVal value As String)
            _lastupdatedby = value
        End Set
    End Property

    Public Sub New()
        cnstr = mainForm.cnstr
    End Sub

    Public Sub add()
        Dim conn As New SqlConnection(cnstr)
        Dim active As Integer = 0

        Dim myQuery As String

        myQuery = "INSERT INTO KPCB VALUES (" & _
                  "'" & serialno & "'," & _
                  "'" & lastupdate & "'," & _
                  "'" & lastupdatedby & "')"

        Dim mycommand As SqlCommand
        mycommand = New SqlCommand(myQuery, conn)

        Try
            conn.Open()
            mycommand.ExecuteNonQuery()
        Catch ex As Exception
            MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error)
        Finally
            conn.Close()
            conn.Dispose()
        End Try
    End Sub

End Class
