我想查詢某個特定記錄的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