I want to insert a row into a table but I need to check if that row already exists based on a column like a persons name. So I need to have 2 statements one for the check and another for the insert. Is the only way I can be sure that the information I received from the first statement that checks if that person name exists is to use a transaction, as it basically tells the database to execute these statements one after another?
If two or more users try to insert the same person and I don't have transactions then I can't rely on the order of how the statements will be executed on the database. Is this correct? Would there be a different way to control the order without using transactions in ASP.NET 1.1?
you don't need transactions. you need a single insert statement. make a field that you are inserting into unique and then either do an insert and deal with the failed messages where duplicate information exists, or do an INSERT ON DUPLICATE UPDATE if that is appropriate ( a new user would get inserted, an existing one would have info in their row updated).