Datable 的 clone 方法....
static public DataTable Get_Table(string table_road,string Schema)
{
DataSet ds=new DataSet ();
ds.ReadXmlSchema(Schema);
ds.ReadXml (table_road,System.Data .XmlReadMode .ReadSchema);
DataTable dt=ds.Tables[0];
DataRow[] drs=dt.Select ("","id DESC");
DataTable dt1=new DataTable ();
dt1=dt.Clone(); //不加这句试试
foreach(DataRow dr in drs)
{
dt1.ImportRow (dr);
}
return dt1 ;
}
{
DataSet ds=new DataSet ();
ds.ReadXmlSchema(Schema);
ds.ReadXml (table_road,System.Data .XmlReadMode .ReadSchema);
DataTable dt=ds.Tables[0];
DataRow[] drs=dt.Select ("","id DESC");
DataTable dt1=new DataTable ();
dt1=dt.Clone(); //不加这句试试
foreach(DataRow dr in drs)
{
dt1.ImportRow (dr);
}
return dt1 ;
}