0
If using sql server there is a keyword "exists"
if exists(select Colname from tablename where colname=@Value)
(
)
just google for "exists in sql serever"
0
The code is simple as it gets:
The card serial number is read from the serial port and stored into a string value (the reader itself writes the value into the active control - I'm using a textBox). When the textBox.TextChanged event is raised (meaning that the serial number has been read), the value is stored into the database using the ordinary INSERT INTO statement.
The code inserting the data from inside that event handler looks like this:
command.CommanText = "INSERT INTO SerialNumbers VALUES ('"+RecordName+"',DateTime,'"+SerialNumber+"','"+comment+"')";
command.ExecuteNonQuery();
As you see these are very simple instructions. My idea how to solve this problem is to use a SELECT statement before this code, and if the returning int (that indicates number of rows affected) is larger than 0 - show a message box stating that the record already exists. Is this the right way, or is there some other approach I should take?
0
Hi Neven
Can you post sample code which you are using