C# windowsphone中的SQL查询表达式
我有一个DB-ScoreDB和table-scoredable,其中包含属性名称和分数。我想按降序显示分数:C# windowsphone中的SQL查询表达式,c#,C#,我有一个DB-ScoreDB和table-scoredable,其中包含属性名称和分数。我想按降序显示分数: t = from ScoreTable s in scoreDB.ScoreTable orderby s.Score descending select s; 行中的错误: GameScoreCollection = new ObservableCollection<ScoreTable>(t
t = from ScoreTable s in scoreDB.ScoreTable
orderby s.Score descending
select s;
行中的错误:
GameScoreCollection = new ObservableCollection<ScoreTable>(t);
表代码:
[Table]
public class ScoreTable : INotifyPropertyChanged, INotifyPropertyChanging
{
[Column(IsPrimaryKey = true, IsDbGenerated = true, DbType = "INT NOT NULL Identity", CanBeNull = false, AutoSync = AutoSync.OnInsert)]
}
private string _Name;
[Column]
public string Name
{
get
{
return _Name;
}
set
{
if (_Name != value)
{
NotifyPropertyChanging("Name");
_Name = value;
NotifyPropertyChanged("Name");
}
}
}
[Column]
private int _Score;
public int Score
{
get
{
return _Score;
}
set
{
if (_Score != value)
{
NotifyPropertyChanging("Score");
_Score = value;
NotifyPropertyChanged("Score");
}
}
}
您的私有变量
得分[Column]
上有[Column]
,公共变量上没有:
private int _Score;
[Column]
public int Score
{
get
{
return _Score;
}
set
{
if (_Score != value)
{
NotifyPropertyChanging("Score");
_Score = value;
NotifyPropertyChanged("Score");
}
}
}
您的私有变量得分[Column]
上有[Column]
,公共变量上没有:
private int _Score;
[Column]
public int Score
{
get
{
return _Score;
}
set
{
if (_Score != value)
{
NotifyPropertyChanging("Score");
_Score = value;
NotifyPropertyChanged("Score");
}
}
}