I’m working in c# and using sql commands to get, add, change data in a Access db. What I would like to do is check a table in the db for specific data, or record. I would need the command to return a value (true/false, 0/1) that will indicate if the data exist or not. My overall goal is to be able to run this check and if the data exist, then do nothing. If the data doesn’t exist, then create it. Does anyone know how to do this. I assume there is a way to do this with sql, but I could be wrong. That’s about it. I hope I presented my problem and question properly.
Share
The approach I would take would be to get all of rows with matching data.
From that point you could simply say if there are any records, do not add the new record.
If you prefer to use COUNT in SQL you could select the number of records
And use ExecuteScalar (Selects the first column of the first row returned)