Deadlock while updating rows and inserting new ones
I bet your code does something like this logic:

IF EXISTS (SELECT 1 FROM dbo.table WHERE key = @key)
BEGIN
  UPDATE dbo.table SET foo = @bar WHERE key = @key;
END
ELSE
BEGIN
  INSERT dbo.table(key, foo) VALUES(@key, @bar);
END


If so, just do this:

UPDATE dbo.table SET foo = @bar WHERE key = @key;
IF @@ROWCOUNT = 0
BEGIN
  INSERT dbo.table(key, foo) VALUES(@key, @bar);
END


That meaningless first SELECT is just a wasted seek (or scan if you are not identifying row(s) by something that can seek), and can often be the cause of deadlocks when you have many users simultaneously running this same piece of code.