I have a code as bellow where I try to insert a data into a table and return the ID (given by auto increment) of the new element.
int newEquipmentID = new int();
query = database.ParameterizedQueryString("INSERT INTO Equipment (EquipmentTypeID) VALUES ({0})", "equipmenttypeID");
newEquipmentID = (int)database.Connection.ExecuteScalar(query, DefaultTimeout, equipment.EquipmentTypeID);
But it fails and returns null, as if the new item wasn't added yet. But actually I can see the new item making a simple consult at the DB.
My question is "when" the data is actually added into the DB and how can I get the ID of the new added item. Thanks!