VERSION 5.00
Object = "{7DEE6B45-AD1E-423B-BD71-12E477844358}#1.0#0"; "NeoRF13Ocxs.ocx"
Begin VB.Form frmRegist 
   Caption         =   "Registration Students"
   ClientHeight    =   3270
   ClientLeft      =   120
   ClientTop       =   450
   ClientWidth     =   5640
   LinkTopic       =   "Form1"
   ScaleHeight     =   3270
   ScaleWidth      =   5640
   StartUpPosition =   3  'Windows 기본값
   Visible         =   0   'False
   Begin NeoRF13Ocxs.NeoRF13Ocx NeoRF13Ocx1 
      Height          =   375
      Left            =   4200
      TabIndex        =   0
      Top             =   -120
      Width           =   1335
      Object.Visible         =   -1  'True
      AutoScroll      =   0   'False
      AutoSize        =   0   'False
      AxBorderStyle   =   0
      Caption         =   "NeoRF13Ocx"
      Color           =   -16777201
      BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
         Name            =   "MS Sans Serif"
         Size            =   8.25
         Charset         =   0
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      KeyPreview      =   0   'False
      PixelsPerInch   =   96
      PrintScale      =   1
      Scaled          =   -1  'True
      DropTarget      =   0   'False
      HelpFile        =   ""
      ScreenSnap      =   0   'False
      SnapBuffer      =   10
      DoubleBuffered  =   0   'False
      Enabled         =   -1  'True
   End
   Begin VB.CommandButton btnLoad 
      Caption         =   "Load"
      Height          =   375
      Left            =   1680
      TabIndex        =   14
      Top             =   2760
      Width           =   1215
   End
   Begin VB.CommandButton btnRegExit 
      Caption         =   "EXIT"
      Height          =   375
      Left            =   4320
      TabIndex        =   13
      Top             =   2760
      Width           =   1215
   End
   Begin VB.CommandButton btnRegRegist 
      Caption         =   "Save"
      Height          =   375
      Left            =   3000
      TabIndex        =   12
      Top             =   2760
      Width           =   1215
   End
   Begin VB.CommandButton btnRegReadUID 
      Caption         =   "Read UID"
      Height          =   375
      Left            =   360
      TabIndex        =   11
      Top             =   2760
      Width           =   1215
   End
   Begin VB.TextBox txtRegAddr 
      Height          =   375
      Left            =   1800
      TabIndex        =   10
      Top             =   2220
      Width           =   3735
   End
   Begin VB.TextBox txtRegPhone 
      Height          =   375
      Left            =   1800
      TabIndex        =   9
      Top             =   1740
      Width           =   3735
   End
   Begin VB.TextBox txtRegName 
      Height          =   375
      Left            =   1800
      TabIndex        =   3
      Top             =   1260
      Width           =   3735
   End
   Begin VB.TextBox txtRegStdNo 
      Height          =   375
      Left            =   1800
      TabIndex        =   2
      Top             =   780
      Width           =   3735
   End
   Begin VB.TextBox txtRegUID 
      BackColor       =   &H80000000&
      Enabled         =   0   'False
      Height          =   375
      Left            =   1800
      TabIndex        =   1
      Top             =   300
      Width           =   3735
   End
   Begin VB.Label lbRegAddr 
      Alignment       =   1  '오른쪽 맞춤
      Caption         =   "Address"
      Height          =   255
      Left            =   600
      TabIndex        =   8
      Top             =   2280
      Width           =   735
   End
   Begin VB.Label lbRegPhone 
      Alignment       =   1  '오른쪽 맞춤
      Caption         =   "Phone"
      Height          =   255
      Left            =   720
      TabIndex        =   7
      Top             =   1800
      Width           =   615
   End
   Begin VB.Label lbRegStdNum 
      Alignment       =   1  '오른쪽 맞춤
      Caption         =   "Student No."
      Height          =   255
      Left            =   240
      TabIndex        =   6
      Top             =   840
      Width           =   1095
   End
   Begin VB.Label lbRegName 
      Alignment       =   1  '오른쪽 맞춤
      Caption         =   "Name"
      Height          =   255
      Left            =   840
      TabIndex        =   5
      Top             =   1320
      Width           =   495
   End
   Begin VB.Label lbRegUID 
      Alignment       =   1  '오른쪽 맞춤
      Caption         =   "UID"
      Height          =   255
      Left            =   960
      TabIndex        =   4
      Top             =   360
      Width           =   375
   End
End
Attribute VB_Name = "frmRegist"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub btnLoad_Click()
    If DBOpen = False Then
        MsgBox "Db Connection Failed.", vbExclamation, "Db Connection"
        Call DBClose
        End
    End If
    
    Dim sSql As String
    Dim sAddItem As String
    Dim iRow As Double
    Dim i As Integer
   
    sSql = "SELECT * FROM KIT_ATT_DB WHERE strUID = '" & txtRegUID.Text & "'"
    Call Execute_SQL(sSql)
    If sSQLSuccess = False Then Exit Sub
    If Rs.RecordCount <= 0 Then
        MsgBox "검색 결과가 없습니다.", vbInformation, "검색"
        Exit Sub
    Else
        Rs.MoveFirst
            
        txtRegStdNo.Text = Rs.Fields(2)
        txtRegName.Text = Rs.Fields(3)
        txtRegPhone.Text = Rs.Fields(4)
        txtRegAddr.Text = Rs.Fields(5)
    End If
    
    
    Call RsClose
    Call DBClose
End Sub

Private Sub btnRegExit_Click()
    Unload Me
End Sub

Private Sub btnRegReadUID_Click()
    txtRegStdNo.Text = ""
    txtRegName.Text = ""
    txtRegAddr.Text = ""
    txtRegPhone.Text = ""
    Call NeoRF13Ocx1.UID_Read
    
    
End Sub

Private Sub btnRegRegist_Click()
    If DBOpen = False Then
        MsgBox "Db Connection Failed.", vbExclamation, "Db Connection"
        Call DBClose
        End
    End If
    
    Dim sSql As String
    Dim msg
    Dim sDate As String
    
           
    
    If txtRegStdNo.Text = "" Then
        MsgBox "학번을 입력하세요.", vbInformation, "등록"
        Exit Sub
    End If
    If txtRegName.Text = "" Then
        MsgBox "이름을 입력하세요.", vbInformation, "등록"
        Exit Sub
    End If
    If txtRegPhone.Text = "" Then
        MsgBox "전화번호를 입력하세요.", vbInformation, "등록"
        Exit Sub
    End If
    
    If txtRegAddr.Text = "" Then
        MsgBox "주소를 입력하세요.", vbInformation, "등록"
        Exit Sub
    End If

    sSql = "SELECT * FROM KIT_ATT_DB WHERE strUID = '" & txtRegUID.Text & "'"
    Call Execute_SQL(sSql)
    If sSQLSuccess = False Then Exit Sub
    If Rs.RecordCount <= 0 Then
        msg = MsgBox("등록하시겠습니까?", vbQuestion + vbYesNo, "등록")
        If msg = vbNo Then Exit Sub
        
        sDate = Format(Now, "yyyy-mm-dd-hh:mm:ss")
        sSql = "INSERT INTO KIT_ATT_DB (strUID, strStdNumber, strName, strPhone, strAddress, strDate) VALUES('" & _
        txtRegUID.Text & "','" & _
        txtRegStdNo.Text & "','" & _
        txtRegName.Text & "','" & _
        txtRegPhone.Text & "','" & _
        txtRegAddr.Text & "','" & _
        sDate & "'" & _
        ")"
                
        Call Execute_SQL(sSql)
        If sSQLSuccess = True Then
            MsgBox "등록되었습니다.", vbInformation, "등록"
        End If
    Else
        msg = MsgBox("수정하시겠습니까?", vbQuestion + vbYesNo, "수정")
        If msg = vbNo Then Exit Sub
        
        sDate = Format(Now, "yyyy-mm-dd-hh:mm:ss")
        sSql = "UPDATE KIT_ATT_DB SET " & _
        "strStdNumber='" & txtRegStdNo.Text & "'," & _
        "strName='" & txtRegName.Text & "'," & _
        "strPhone='" & txtRegPhone.Text & "'," & _
        "strAddress='" & txtRegAddr.Text & "'," & _
        "strDate='" & sDate & "'" & _
        "where strUID = '" & txtRegUID.Text & "'"

        
        Call Execute_SQL(sSql)
        If sSQLSuccess = True Then
            MsgBox "수정되었습니다.", vbInformation, "수정"
        End If
    End If
    
    
    Call RsClose
    Call DBClose
    
End Sub

Private Sub NeoRF13Ocx1_OnData(ByVal sData As String)
    txtRegUID.Text = sData
End Sub
