dataview 控件内容到datatable


private  DataTable get_datatable()
        {
            gridView1.RefreshEditor();

            
object  data  =  gridView1.DataSource;
            DataTable dataTable 
=   null ;
            
if  (data  is  DataSet)
            {
                DataSet ds 
=  data  as  DataSet;
                
if  (ds  !=   null   &&  ds.Tables.Count  ==   1 )
                {
                    dataTable 
=  ds.Tables[ 0 ];
                }
            }
            
else   if  (data  is  DataView)
            {
                DataView dv 
=  data  as  DataView;
                dataTable 
=  dv.Table;
            }
            
else   if  (data  is  DataTable)
            {
                dataTable 
=  data  as  DataTable;
            }
            
return  dataTable;
        }

你可能感兴趣的:(dataview 控件内容到datatable)