DbConnect()
Dim cmdSelect As New SqlCommand(SQLCMD, _conn)
Dim reader As SqlDataReader = cmdSelect.ExecuteReader
If (reader.Read()) Then If Trim(((reader("CC_CREDITCARD")) = txtCode.Text)) Then
'MessageBox.Show("รหัสนี้มีอยู่ในฐานข้อมูลแล้ว!!!", "ผลการทำงาน", MessageBoxButtons.OK, MessageBoxIcon.Error)
MsgShow("SC0015", "", 1)
BlankCD()
txtCode.Focus()
_conn.Close()
Return True
End If
Private Function CheckAddData() As Boolean
Dim Sb As New System.Text.StringBuilder()
Sb.Append("Select Count([CC_CREDITCARD]) ")
Sb.Append("FROM [VSC_CREDITCARD] ")
Sb.Append("WHERE [CC_CREDITCARD] = @Code")
DbConnect()
Dim SQLCMD As String = Sb.ToString()
Dim cmdSelect As New SqlCommand(SQLCMD, _conn)
cmdSelect.Parameters.AddWithValue("@Code", txtCode.Text.Trim())
Dim result As Integer = CInt(cmdSelect.ExecuteScalar())
_conn.Close()
Return If((result > 0), True, False)
End Function