2013-05-03 49 views
0

我試圖從Windows Azure的對象表存儲列表做批量插入。批量插入添加到表存儲在Windows Azure中

我使用存儲模擬器現在。 我得到這個錯誤:

"Unexpected response code for operation".

我試圖尋找誰遇到過類似問題的人,但無濟於事。

我的鍵設置是這樣的:

PartitionKey = "projects" + CompanyID.toString(); 
RowKey = ProjectID.toString(); 

它插入這樣的:

foreach (vProject item in projectList) 
     { 
      TableOperation retrieveOperation = TableOperation.Retrieve<mMultipleSave.ViewProjectEntity>("projects" + CompanyID.toString(), item.ProjectID.ToString()); 

      TableResult retrievedResult = table.Execute(retrieveOperation); 

      if (retrievedResult.Result != null) 
      { 
       mMultipleSave.ViewProjectEntity updateEntity = (mMultipleSave.ViewProjectEntity)retrievedResult.Result; 
       if (!item.isProjectArchived) 
       { 
        //update entity in table storage 
        updateEntity.ProjectClient = item.ClientName; 
        updateEntity.ProjectCompany = item.Company; 
        updateEntity.ProjectName = item.ProjectName; 
        batchUpdateOperation.Replace(updateEntity); 
       } 
       else { 
        //delete project in table storage if it is archived in the database 
        batchDeleteOperation.Delete(updateEntity); 
       } 
      } 
      else //if it does not exist in table storage insert 
      { 
       mMultipleSave.ViewProjectEntity entity = new mMultipleSave.ViewProjectEntity(CompanyID, item.ProjectID); 

       entity.ProjectClient = item.ClientName; 
       entity.ProjectCompany = item.Company; 
       entity.ProjectName = item.ProjectName; 

       batchInsertOperation.Insert(entity); 

      } 
     } 
     if (batchInsertOperation.Count > 0) 
      table.ExecuteBatch(batchInsertOperation); 
     if (batchUpdateOperation.Count > 0) 
      table.ExecuteBatch(batchUpdateOperation); 
     if (batchDeleteOperation.Count > 0) 
      table.ExecuteBatch(batchDeleteOperation); 

沾到table.ExecuteBatch(batchInsertOperation);

請幫助錯誤。

回答

0

我已經解決了這個問題。將您的windows azure工具(包括模擬器)更新到最新版本。截至今天,它在版本2.0中