C# asp.net c中的数据集排序#
我试图对数据进行排序,但是当我从一个页面跳转到另一个页面时,名称不会被排序C# asp.net c中的数据集排序#,c#,asp.net,dataset,C#,Asp.net,Dataset,我试图对数据进行排序,但是当我从一个页面跳转到另一个页面时,名称不会被排序 return new dao_StudentGroupStudents().GetNewStudentbyGroup(bureauId, search, groupId, currentPage, pageSize, out totalCount); /// <summary> /// Get All the students from that Bureau. /// </s
return new dao_StudentGroupStudents().GetNewStudentbyGroup(bureauId, search, groupId, currentPage, pageSize, out totalCount);
/// <summary>
/// Get All the students from that Bureau.
/// </summary>
public DataSet GetAllStudentGroupByBureau(int? GroupId, int? BureauID)
{
DataSet ds = new dao_StudentGroup().GetDataSet(null, null, BureauID);
ds.Tables[0].DefaultView.Sort = "grouptitle asc";
return ds;
}
}试试这个:
return new dao_StudentGroupStudents().GetNewStudentbyGroup(bureauId, search, groupId, currentPage, pageSize, out totalCount);
/// <summary>
/// Get All the students from that Bureau.
/// </summary>
public DataSet GetAllStudentGroupByBureau(int? GroupId, int? BureauID)
{
DataSet ds = new dao_StudentGroup().GetDataSet(null, null, BureauID);
ds.Tables[0].DefaultView.Sort = "grouptitle asc";
return ds;
}
DataSet ds = new dao_StudentGroup().GetDataSet(null, null, BureauID);
ds.Tables[0].DefaultView.Sort = "grouptitle asc";
ds.Tables[0] = ds.Tables[0].DefaultView.ToTable();
return ds;
更新
return new dao_StudentGroupStudents().GetNewStudentbyGroup(bureauId, search, groupId, currentPage, pageSize, out totalCount);
/// <summary>
/// Get All the students from that Bureau.
/// </summary>
public DataSet GetAllStudentGroupByBureau(int? GroupId, int? BureauID)
{
DataSet ds = new dao_StudentGroup().GetDataSet(null, null, BureauID);
ds.Tables[0].DefaultView.Sort = "grouptitle asc";
return ds;
}
您只需执行以下操作:
return new dao_StudentGroupStudents().GetNewStudentbyGroup(bureauId, search, groupId, currentPage, pageSize, out totalCount);
/// <summary>
/// Get All the students from that Bureau.
/// </summary>
public DataSet GetAllStudentGroupByBureau(int? GroupId, int? BureauID)
{
DataSet ds = new dao_StudentGroup().GetDataSet(null, null, BureauID);
ds.Tables[0].DefaultView.Sort = "grouptitle asc";
return ds;
}
public DataSet GetAllStudentGroupByBureau(int ? GroupId, int ? BureauID)
{
DataSet ds = new dao_StudentGroup().GetDataSet(null, null, BureauID);
ds.Tables[0].DefaultView.Sort = "grouptitle asc";
DataTable dt = ds.Tables[0].DefaultView.ToTable();
ds.Tables[0].Rows.Clear();
foreach (DataRow row in dt.Rows)
ds.Tables[0].Rows.Add(row.ItemArray);
return ds;
}
试试这个:
return new dao_StudentGroupStudents().GetNewStudentbyGroup(bureauId, search, groupId, currentPage, pageSize, out totalCount);
/// <summary>
/// Get All the students from that Bureau.
/// </summary>
public DataSet GetAllStudentGroupByBureau(int? GroupId, int? BureauID)
{
DataSet ds = new dao_StudentGroup().GetDataSet(null, null, BureauID);
ds.Tables[0].DefaultView.Sort = "grouptitle asc";
return ds;
}
DataSet ds = new dao_StudentGroup().GetDataSet(null, null, BureauID);
ds.Tables[0].DefaultView.Sort = "grouptitle asc";
ds.Tables[0] = ds.Tables[0].DefaultView.ToTable();
return ds;
更新
return new dao_StudentGroupStudents().GetNewStudentbyGroup(bureauId, search, groupId, currentPage, pageSize, out totalCount);
/// <summary>
/// Get All the students from that Bureau.
/// </summary>
public DataSet GetAllStudentGroupByBureau(int? GroupId, int? BureauID)
{
DataSet ds = new dao_StudentGroup().GetDataSet(null, null, BureauID);
ds.Tables[0].DefaultView.Sort = "grouptitle asc";
return ds;
}
您只需执行以下操作:
return new dao_StudentGroupStudents().GetNewStudentbyGroup(bureauId, search, groupId, currentPage, pageSize, out totalCount);
/// <summary>
/// Get All the students from that Bureau.
/// </summary>
public DataSet GetAllStudentGroupByBureau(int? GroupId, int? BureauID)
{
DataSet ds = new dao_StudentGroup().GetDataSet(null, null, BureauID);
ds.Tables[0].DefaultView.Sort = "grouptitle asc";
return ds;
}
public DataSet GetAllStudentGroupByBureau(int ? GroupId, int ? BureauID)
{
DataSet ds = new dao_StudentGroup().GetDataSet(null, null, BureauID);
ds.Tables[0].DefaultView.Sort = "grouptitle asc";
DataTable dt = ds.Tables[0].DefaultView.ToTable();
ds.Tables[0].Rows.Clear();
foreach (DataRow row in dt.Rows)
ds.Tables[0].Rows.Add(row.ItemArray);
return ds;
}
你可以试试这个:
return new dao_StudentGroupStudents().GetNewStudentbyGroup(bureauId, search, groupId, currentPage, pageSize, out totalCount);
/// <summary>
/// Get All the students from that Bureau.
/// </summary>
public DataSet GetAllStudentGroupByBureau(int? GroupId, int? BureauID)
{
DataSet ds = new dao_StudentGroup().GetDataSet(null, null, BureauID);
ds.Tables[0].DefaultView.Sort = "grouptitle asc";
return ds;
}
//convert DataSet table to DataView
DataView dv = ds.Tables[0].DefaultView;
//apply the sort
dv.Sort = "grouptitle ASC";
//save back into our dataset
ds.Tables[0] = dv.ToTable();
你可以试试这个:
return new dao_StudentGroupStudents().GetNewStudentbyGroup(bureauId, search, groupId, currentPage, pageSize, out totalCount);
/// <summary>
/// Get All the students from that Bureau.
/// </summary>
public DataSet GetAllStudentGroupByBureau(int? GroupId, int? BureauID)
{
DataSet ds = new dao_StudentGroup().GetDataSet(null, null, BureauID);
ds.Tables[0].DefaultView.Sort = "grouptitle asc";
return ds;
}
//convert DataSet table to DataView
DataView dv = ds.Tables[0].DefaultView;
//apply the sort
dv.Sort = "grouptitle ASC";
//save back into our dataset
ds.Tables[0] = dv.ToTable();
您可以尝试以下方法。请记住,不能将值赋给ds.Table[]。因此,您需要创建一个新的数据表,并将其添加到新的或现有的数据集中
return new dao_StudentGroupStudents().GetNewStudentbyGroup(bureauId, search, groupId, currentPage, pageSize, out totalCount);
/// <summary>
/// Get All the students from that Bureau.
/// </summary>
public DataSet GetAllStudentGroupByBureau(int? GroupId, int? BureauID)
{
DataSet ds = new dao_StudentGroup().GetDataSet(null, null, BureauID);
ds.Tables[0].DefaultView.Sort = "grouptitle asc";
return ds;
}
ds.Tables[0].DefaultView.Sort = "columnName ASC";
DataTable dt = ds.Tables[0].DefaultView.ToTable();
您可以尝试以下方法。请记住,不能将值赋给ds.Table[]。因此,您需要创建一个新的数据表,并将其添加到新的或现有的数据集中
return new dao_StudentGroupStudents().GetNewStudentbyGroup(bureauId, search, groupId, currentPage, pageSize, out totalCount);
/// <summary>
/// Get All the students from that Bureau.
/// </summary>
public DataSet GetAllStudentGroupByBureau(int? GroupId, int? BureauID)
{
DataSet ds = new dao_StudentGroup().GetDataSet(null, null, BureauID);
ds.Tables[0].DefaultView.Sort = "grouptitle asc";
return ds;
}
ds.Tables[0].DefaultView.Sort = "columnName ASC";
DataTable dt = ds.Tables[0].DefaultView.ToTable();
DataView dv=ds.Tables[0].DefaultView
return new dao_StudentGroupStudents().GetNewStudentbyGroup(bureauId, search, groupId, currentPage, pageSize, out totalCount);
/// <summary>
/// Get All the students from that Bureau.
/// </summary>
public DataSet GetAllStudentGroupByBureau(int? GroupId, int? BureauID)
{
DataSet ds = new dao_StudentGroup().GetDataSet(null, null, BureauID);
ds.Tables[0].DefaultView.Sort = "grouptitle asc";
return ds;
}
dv.Sort = "grouptitle ASC";
ds = dv.ToTable();
试试这些
return new dao_StudentGroupStudents().GetNewStudentbyGroup(bureauId, search, groupId, currentPage, pageSize, out totalCount);
/// <summary>
/// Get All the students from that Bureau.
/// </summary>
public DataSet GetAllStudentGroupByBureau(int? GroupId, int? BureauID)
{
DataSet ds = new dao_StudentGroup().GetDataSet(null, null, BureauID);
ds.Tables[0].DefaultView.Sort = "grouptitle asc";
return ds;
}
默认值在ds.table[0]中,无需对其进行测量DataView dv=ds.Tables[0]。默认视图
return new dao_StudentGroupStudents().GetNewStudentbyGroup(bureauId, search, groupId, currentPage, pageSize, out totalCount);
/// <summary>
/// Get All the students from that Bureau.
/// </summary>
public DataSet GetAllStudentGroupByBureau(int? GroupId, int? BureauID)
{
DataSet ds = new dao_StudentGroup().GetDataSet(null, null, BureauID);
ds.Tables[0].DefaultView.Sort = "grouptitle asc";
return ds;
}
dv.Sort = "grouptitle ASC";
ds = dv.ToTable();
试试这些
return new dao_StudentGroupStudents().GetNewStudentbyGroup(bureauId, search, groupId, currentPage, pageSize, out totalCount);
/// <summary>
/// Get All the students from that Bureau.
/// </summary>
public DataSet GetAllStudentGroupByBureau(int? GroupId, int? BureauID)
{
DataSet ds = new dao_StudentGroup().GetDataSet(null, null, BureauID);
ds.Tables[0].DefaultView.Sort = "grouptitle asc";
return ds;
}
默认情况下,它出现在ds.表[0]中,无需测量它的尺寸。这里有问题吗?那么它在第一页上的排序正确吗?这里有问题吗?那么它在第一页上的排序正确吗?ds.表[0]产生错误。属性或索引system.DataTablesCollection。无法将此[int]分配给is is read onlyds。表[0]生成错误。属性或索引system.DataTablesCollection。无法将此[int]分配给is is read onlyds。表[0]生成错误。属性或索引系统。DataTablesCollection。此[int]无法分配给is为只读。我现在收到此错误错误6“BusinessObjects.StudentGroupManager”未实现接口成员“BusinessObjects.Contracts.IStudentGroupManager.GetAllStudentGroupByBureau(int?,int?)”BusinessObjects.StudentGroupManager.GetAllStudentGroupByBureau(int?,int?)无法实现“BusinessObjects.Contracts.IsStudentGroupManager.GetAllStudentGroupByBureau(int?),因为它没有匹配的返回类型“System.Data.DataSet”。C:\workspace\DOP.IT.Training\Development\MS\BusinessObjects\StudentGroupManager.cs 11 18 BusinessObjects数据表dt中的第二个“=”给了我一个无效的表达式项和ds。正在给我一个“预期的”@user2208126:对不起,那是一个打字错误。我已经更新了代码。试试看!表[0]产生错误。属性或索引系统。DataTablesCollection。此[int]无法分配给is为只读。我现在收到此错误错误6“BusinessObjects.StudentGroupManager”未实现接口成员“BusinessObjects.Contracts.IStudentGroupManager.GetAllStudentGroupByBureau(int?,int?)”BusinessObjects.StudentGroupManager.GetAllStudentGroupByBureau(int?,int?)无法实现“BusinessObjects.Contracts.IsStudentGroupManager.GetAllStudentGroupByBureau(int?),因为它没有匹配的返回类型“System.Data.DataSet”。C:\workspace\DOP.IT.Training\Development\MS\BusinessObjects\StudentGroupManager.cs 11 18 BusinessObjects数据表dt中的第二个“=”给了我一个无效的表达式项和ds。正在给我一个“预期的”@user2208126:对不起,那是一个打字错误。我已经更新了代码。试试看!=正在给我一个无效的表达式术语我现在遇到此错误错误错误6“BusinessObjects.StudentGroupManager”未实现接口成员“BusinessObjects.Contracts.IStudentGroupManager.GetAllStudentGroupByBureau(int?,int?)”BusinessObjects.StudentGroupManager.GetAllStudentGroupByBureau(int?,int?)无法实现“BusinessObjects.Contracts.IsStudentGroupManager.GetAllStudentGroupByBureau(int?),因为它没有匹配的返回类型“System.Data.DataSet”。C:\workspace\DOP.IT.Training\Development\MS\BusinessObjects\StudentGroupManager。cs 11 18 BusinessObjectsI能够编译上述代码,没有任何错误。通过查看上面的代码,似乎还有其他原因导致了这个问题。我把这个放进去了,但是我找不到columnName。公共数据集GetAllStudentGroupByBureau(int?GroupId,int?BureauID){DataSet ds=new dao_StudentGroup().GetDataSet(null,null,BureauID);ds.Tables[0]。DefaultView.Sort=“columnName ASC”;DataTable dt=ds.Tables[0]。DefaultView.ToTable();return ds;}显然columnName表示要排序的字段名称。您需要将其更改为原始列名,它仅用于参考/示例=正在给我一个无效的表达式术语我现在收到此错误错误6“BusinessObjects.StudentGroupManager”未实现接口成员“BusinessObjects.Contracts.IStudentGroupManager.GetAllStudentGroupByBureau(int?、int?)”BusinessObjects.StudentGroupManager.GetAllStudentGroupByBureau(int?,int?)无法实现“BusinessObjects.Contracts.IsStudentGroupManager.GetAllStudentGroupByBureau(int?),因为它没有匹配的返回类型“System.Data.DataSet”。C:\workspace\DOP.IT.Training\Development\MS\BusinessObjects\StudentGroupManager。cs 11 18 BusinessObjectsI能够编译上述代码,没有任何错误。通过查看上面的代码,似乎还有其他原因导致了这个问题。我把这个放进去了,但是我找不到columnName。公共数据集GetAllStudentGroupByBureau(int?GroupId,int?BureauID){DataSet ds=new dao_StudentGroup().GetDataSet(null,null,BureauID);ds.Tables[0]。DefaultView.Sort=“columnName ASC”;DataTable dt=ds.Tables[0]。DefaultView.ToTable();return ds;}显然columnName表示要排序的字段名称。您需要将其更改为原始列名,它仅用于参考/示例
return new dao_StudentGroupStudents().GetNewStudentbyGroup(bureauId, search, groupId, currentPage, pageSize, out totalCount);
/// <summary>
/// Get All the students from that Bureau.
/// </summary>
public DataSet GetAllStudentGroupByBureau(int? GroupId, int? BureauID)
{
DataSet ds = new dao_StudentGroup().GetDataSet(null, null, BureauID);
ds.Tables[0].DefaultView.Sort = "grouptitle asc";
return ds;
}