DataTable opertion

1. Definition 

DataTable dt  =   new  DataTable( " TableName " );

DataSet ds 
=   new  DataSet( " SetName " );
DataTable dt 
=  ds.Tables.Add( " TableName " );


dt.Columns.Add(
" ColumnName " , System.Type.GetType( " System.String " ));
dt.PrimaryKey 
=   new  DataColumn[] { dt.Columns[ " ColumnName " ] };

 

2. Add data

DataRow row  =  dt.NewRow();
row[
" ColumnName " =   " ColumnValue " ;
dt.Rows.Add(row);

 

3.  TBC

你可能感兴趣的:(Datatable)