我想查询某个特定记录的azure移动服务数据库。我需要查询来查找NotifyDate
列等于当前日期的记录。然后从找到的记录中,我想获取记录的Name
列中的字符串值,并将其存储在我可以在数据库之外使用的字符串中。需要帮助查询azure移动服务数据库
这是我想出的,但它给我一个错误:
Cannot convert method group 'ToString' to non delegate type 'string'. Did you intend to invoke the method?
在下面一行:
string NotifyDate = FindNotifyDate().ToString;
是否有你能想到更好的办法要做到这一点?
目前代码:
private IMobileServiceTable<TodoItem> todoTable =
MobileService.GetTable<TodoItem>();
private MobileServiceCollection<TodoItem, TodoItem> items;
private List<TodoItem> notifyItems;
protected void Application_Start()
{
WebApiConfig.Register();
string NotifyDate = FindNotifyDate().ToString;
}
public async Task<TodoItem> FindNotifyDate()
{
DateTime test = DateTime.Now;
test = test.AddMilliseconds(-test.Millisecond);
notifyItems = await todoTable.Where(todoItem => todoItem.NotifyDate == test)
.ToListAsync();
return notifyItems[0];
}
这有什么好运气? – Artiom