実際、データベーステーブルにpartnoが存在するかどうかを調べようとしていますが、count =checkCommand.ExecuteReadersataementで時間がかかります。
以下の方法を見つけてください
Public Function CheckProductNo(ByVal Partno As String) As Boolean
Dim count As SqlDataReader
Dim valid As Boolean = False
Using connection As New SqlConnection
connection.Open()
Using checkCommand As New SqlCommand("PartNo_check", connection)
checkCommand.CommandType = CommandType.StoredProcedure
checkCommand.Parameters.Add(New SqlParameter("@PartNo", Partno))
count = checkCommand.ExecuteReader
If count.ToString > 0 Then
valid = True
End If
End Using
End Using
Return valid
End Function
STORED PROCEDURE
CREATE PROCEDURE PartNo_Check
@PartNo VARCHAR(30)
AS
SELECT PartNo from T_Product where PartNo=@Partno
Thanks