Subsonic 如何从亚音速查询返回数据表?

Subsonic 如何从亚音速查询返回数据表?,subsonic,Subsonic,我试图从我用亚音速编写的查询中返回一个datatable(我刚刚开始学习),但只能返回一个DataSet public DataTable GetAllCarTypes() { return new Query("tblCarType").ExecuteDataSet(); } 我希望是.ExecuteDataTable() 啊哈。。我应该在发布之前考虑过,我想我现在已经有了 public DataTable GetAllCarTypes() { return new Quer

我试图从我用亚音速编写的查询中返回一个datatable(我刚刚开始学习),但只能返回一个DataSet

public DataTable GetAllCarTypes()
{
    return new Query("tblCarType").ExecuteDataSet();
}

我希望是.ExecuteDataTable()

啊哈。。我应该在发布之前考虑过,我想我现在已经有了

public DataTable GetAllCarTypes()
{
    return new Query("tblCarType").ExecuteDataSet().Tables[0];
}

如果没有,请发布正确的语法。如果查询只返回1个表,可以执行以下操作:

public DataTable GetAllCarTypes()
{
    return new Query("tblCarType").ExecuteDataSet().Tables[0];
}

丑陋但正确。亚音速绝对需要ExecuteDataTable()。我不明白为什么有人只需要一个数据表就使用数据集。