diff --git a/OpenSim/Data/MSSQL/MSSQLInventoryData.cs b/OpenSim/Data/MSSQL/MSSQLInventoryData.cs
index 1482184402..c1eee8d179 100644
--- a/OpenSim/Data/MSSQL/MSSQLInventoryData.cs
+++ b/OpenSim/Data/MSSQL/MSSQLInventoryData.cs
@@ -635,9 +635,9 @@ namespace OpenSim.Data.MSSQL
/// connection to the database
private void DeleteItemsInFolder(UUID folderID, SqlConnection connection)
{
- using (SqlCommand command = new SqlCommand("DELETE FROM inventoryitems WHERE folderID=@folderID", connection))
+ using (SqlCommand command = new SqlCommand("DELETE FROM inventoryitems WHERE parentFolderID=@parentFolderID", connection))
{
- command.Parameters.Add(database.CreateParameter("folderID", folderID));
+ command.Parameters.Add(database.CreateParameter("parentFolderID", folderID));
try
{
diff --git a/OpenSim/Data/MSSQL/MSSQLUserData.cs b/OpenSim/Data/MSSQL/MSSQLUserData.cs
index 3ef10535a8..7fe8ed08a0 100644
--- a/OpenSim/Data/MSSQL/MSSQLUserData.cs
+++ b/OpenSim/Data/MSSQL/MSSQLUserData.cs
@@ -582,8 +582,21 @@ namespace OpenSim.Data.MSSQL
/// the appearence
override public void UpdateUserAppearance(UUID user, AvatarAppearance appearance)
{
- string sql = @"DELETE FROM avatarappearance WHERE owner=@owner;
- INSERT INTO avatarappearance
+ string sql = @"DELETE FROM avatarappearance WHERE owner=@owner";
+ using (AutoClosingSqlCommand cmd = database.Query(sql))
+ {
+ cmd.Parameters.Add(database.CreateParameter("@owner", appearance.Owner));
+ try
+ {
+ cmd.ExecuteNonQuery();
+ }
+ catch (Exception e)
+ {
+ m_log.ErrorFormat("[USER DB] Error deleting old user appearance, error: {0}", e.Message);
+ }
+ }
+
+ sql=@"INSERT INTO avatarappearance
(owner, serial, visual_params, texture, avatar_height,
body_item, body_asset, skin_item, skin_asset, hair_item,
hair_asset, eyes_item, eyes_asset, shirt_item, shirt_asset,