C# 将数据检索到UWP的Sql数据库
我的数据库已连接到UWP 我有这段代码,它可以工作并提取所有没有空名称的数据C# 将数据检索到UWP的Sql数据库,c#,sql,database,uwp,azure-sql-database,C#,Sql,Database,Uwp,Azure Sql Database,我的数据库已连接到UWP 我有这段代码,它可以工作并提取所有没有空名称的数据 private async Task GetStory() { MobileServiceInvalidOperationException exception = null; try { // This code gets the entries in the list view by que
private async Task GetStory()
{
MobileServiceInvalidOperationException exception = null;
try
{
// This code gets the entries in the list view by querying the stories table.
items = await storyTable
.Where(todoItem => todoItem.Name != null)
.ToCollectionAsync();
}
catch (MobileServiceInvalidOperationException e)
{
exception = e;
}
if (exception != null)
{
await new MessageDialog(exception.Message, "Error loading items").ShowAsync();
}
else
{
ListViewItems.ItemsSource = items;
}
}
如果故事是真是假,我想加载数据。。在我的表中,我有一个名为isTrue的bool列,我将每个故事的值设置为true或false。我试图让真实的故事展现出来,但例外情况突然出现。
下面是不起作用的代码。。我刚换了个名字!=空到。是真的=false我也试过了。isTrue==真的,但似乎没有任何效果
private async Task GetStory()
{
MobileServiceInvalidOperationException exception = null;
try
{
// This code gets the entries in the list view by querying the stories table.
items = await storyTable
.Where(todoItem => todoItem.isTrue != false)
.ToCollectionAsync();
}
catch (MobileServiceInvalidOperationException e)
{
exception = e;
}
if (exception != null)
{
await new MessageDialog(exception.Message, "Error loading items").ShowAsync();
}
else
{
ListViewItems.ItemsSource = items;
}
}
有人能帮忙吗
提前感谢那么您收到的异常消息是什么?加载项目时出错。。它的编码是在异常显示时显示此信息。
exception.Message
部分…{“请求无法完成。(请求错误)”}检查此问题,它可能与此相关。那么,您得到的异常消息是什么?加载项目时出错。。它的编码是在异常显示时显示此信息。exception.Message
部分…{“请求无法完成。(请求错误)”}检查此问题,它可能与此相关。