我想對查詢表存儲,但我收到以下錯誤:的Windows Azure表存儲查詢錯誤 - 其中一個請求輸入無效
<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<error xmlns="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata">
<code>InvalidInput</code>
<message xml:lang="en-US">One of the request inputs is not valid.</message>
</error>
我使用的代碼如下:
public IEnumerable<ShoppingItemEntity> Get(string shoppingRowKey) {
var ctx = getTableServiceContext();
var shoppingItems = ctx.CreateQuery<ShoppingItemEntity>(
Constants.TABLE_STORAGE_SHOPPING_ITEM_TABLE_NAME
).Where(x => x.PartitionKey == string.Empty && x.ShoppingId == shoppingRowKey).AsTableServiceQuery();
return shoppingItems.ToList();
}
private TableServiceContext getTableServiceContext() {
var account = CloudStorageAccount.Parse(ConfigurationManager.AppSettings["DataConnectionString"]);
return account.CreateCloudTableClient().GetDataServiceContext();
}
這裏奇怪的是,如果我不跑where子句的查詢,我沒有得到任何錯誤:
public IEnumerable<ShoppingItemEntity> Get(string shoppingRowKey) {
var ctx = getTableServiceContext();
var shoppingItems = ctx.CreateQuery<ShoppingItemEntity>(
Constants.TABLE_STORAGE_SHOPPING_ITEM_TABLE_NAME
).AsTableServiceQuery();
return shoppingItems.ToList();
}
你認爲這裏的問題是什麼?