In SQL Server 2005+: If there is no insert trigger available, then try changing the insert statement (all in one line) to this
INSERT INTO aspnet_GameProfiles(UserId,GameId)
OUTPUT INSERTED.ID
VALUES(@UserId, @GameId)
In SQL Server 2000, if there is an insert trigger like this:
INSERT INTO aspnet_GameProfiles(UserId,GameId)
VALUES(@UserId, @GameId);
SELECT SCOPE_IDENTITY()
Then use this:
Int32 newId = (Int32) myCommand.ExecuteScalar();