private void ClearDataSet(DataSet dataSet) { // To test, print the number rows in each table. foreach(DataTable table in dataSet.Tables) { Console.WriteLine(table.TableName + "Rows.Count = " + table.Rows.Count.ToString()); } // Clear all rows of each table. dataSet.Clear(); // Print the number of rows again. foreach(DataTable table in dataSet.Tables) { Console.WriteLine(table.TableName + "Rows.Count = " + table.Rows.Count.ToString()); } }
函数功能:该函数删除一个窗口类,清空该类所需的内存。
函数原型:BOOL UnRegisterClass(LPCTSTR IpClassName; HINSTANCE hlnstance);
参数:
托管的代码内存管理不了
using 语句是可以在用完后释放掉对象
佩服,这都能找到,,我咋就弄不明白MSDN呢?
是清空dataset里面的数据把
dataset.clear() 就可以了
{
// To test, print the number rows in each table.
foreach(DataTable table in dataSet.Tables)
{
Console.WriteLine(table.TableName + "Rows.Count = "
+ table.Rows.Count.ToString());
}
// Clear all rows of each table.
dataSet.Clear(); // Print the number of rows again.
foreach(DataTable table in dataSet.Tables)
{
Console.WriteLine(table.TableName + "Rows.Count = "
+ table.Rows.Count.ToString());
}
}