asp.net - Know if a record was just inserted via C# 4.0? -
is possible in c# / asp.net know if executenonquery inserted record or not?
i checking make sure email address not exist in table using subquery.
is there way know if insert made in asp.net?
commandprizeemails.parameters.add("@email", sqldbtype.varchar, 50); commandprizeemails.parameters.add("@datetoday", sqldbtype.datetime); commandprizeemails.parameters["@email"].value = txtemail.text; commandprizeemails.parameters["@datetoday"].value = datetime.now; commandprizeemails.executenonquery(); //int newid = (int)commandprizeemails.executescalar(); //commandprizeemails.executenonquery(); //if (newid >= 1) { // divsuccesfulentry.visible = true; //} else { // divrepeatentry.visible = true; //}
you can rows affected in return verify process.
for update, insert, , delete statements, return value number of rows affected command.
when trigger exists on table being inserted or updated, return value includes number of rows affected both insert or update operation , number of
rows affected trigger or triggers. other types of statements, return value -1. if rollback occurs, return value -1.
Comments
Post a Comment