private void DemonstrateRowVersions(){
   // Create a DataTable.
   DataTable myTable = new DataTable("myTable");
   // Create two columns. Set DataType and DefaultValue properties.
   DataColumn col1 = new DataColumn("col1");
   col1.DataType=System.Type.GetType("System.String");
   col1.DefaultValue= "myDefaultValue";
   DataColumn col2 = new DataColumn("col2");
   col2.DataType=System.Type.GetType("System.Decimal");
   col2.DefaultValue=.1;
   // Add Columns to the DataTable.
   myTable.Columns.Add (col1);
   myTable.Columns.Add(col2);
   DataRow newRow;
   // Create one row and add it to the DataRow collection.
   newRow = myTable.NewRow();
   newRow[col1]="Nitrogen";
   newRow[col2]=33;
   myTable.Rows.Add(newRow);
   // Invoke AcceptChanges on the table.
   myTable.AcceptChanges();
   // Print the current values:
   PrintRowVersion(myTable, DataRowVersion.Current);

解决方案 »

  1.   

    Sorry!我刚才没有说清楚,我所说的表是在ORACLE数据库中创建表,而不是在数据集中。
    private OleDbCommand NewBDTableCommand()
    {
    if(newBDTableCommand == null)
    {

    OleDbConnection testConnection = new OleDbConnection(LabManageConfiguration.ConnectionString);
    string mySelectQuery="CREATE TABLE"+BDData.BD_TABLE+"....... ";
    newBDTableCommand =new OleDbCommand(mySelectQuery, testConnection);
    //BData是已经构建的数据集,BD_TABLE是该数据集内的表名( 变量)
    newBDTableCommand.Parameters.Add(new OleDbParameter(BDData.BD_TABLE, OleDbType.VarChar,10 ));
    }
    return newBDTableCommand;
    }