'IN' 给出空结果 - c# 和 cosmos
'IN' gives empty result - c# and cosmos
我正在尝试查询 cosmos 并且查询有效。查询看起来像
'Select * from c where c.id IN ('123', '456')'.
现在在我的 C# 代码中,我得到空结果。 C# 代码如下所示:
public void GetValue(IEnumerable<string> ids, string s)
{
StringBuilder sb = new();
_ = sb.Append("SELECT t.id FROM t ")
.Append("WHERE t.id IN (@items) ")
.Append("AND t.state != @state");
var queryDefinition = new QueryDefinition(sb.ToString())
.WithParameter("@items", ids)
.WithParameter("@state", s);
var results = GetQueryResults<TableName>(queryDefinition); // Get Empty Result
// Some logic based on results
}
// GetQueryResults query the container and gets the result for the tableName.
所以,我可以断定 'IN' 查询语法不正确。谁能帮帮我。
我正在尝试查询 cosmos 并且查询有效。查询看起来像
'Select * from c where c.id IN ('123', '456')'.
现在在我的 C# 代码中,我得到空结果。 C# 代码如下所示:
public void GetValue(IEnumerable<string> ids, string s)
{
StringBuilder sb = new();
_ = sb.Append("SELECT t.id FROM t ")
.Append("WHERE t.id IN (@items) ")
.Append("AND t.state != @state");
var queryDefinition = new QueryDefinition(sb.ToString())
.WithParameter("@items", ids)
.WithParameter("@state", s);
var results = GetQueryResults<TableName>(queryDefinition); // Get Empty Result
// Some logic based on results
}
// GetQueryResults query the container and gets the result for the tableName.
所以,我可以断定 'IN' 查询语法不正确。谁能帮帮我。