Is there a specific reason that you're generating the PK yourself? Does that data have some specific meaning or is it just an identifier? If it's the latter then you should just let the database create it for you and not care what it is.
If you really do need to create it yourself then you would query the database and use a WHERE clause to filter out all non-matching records but, instead of getting the data itself, you get a count of the data. You can then create a command and call ExecuteScalar, which is specifically for retrieving a single value. That value will be zero if there are no matches and non-zero otherwise.