Ejemplo n.º 1
0
        public void createObjectsTable(ref DataSet myDataSet, ref StructFunctions.objectsStruct myDataTableStruct, ref DataTable myTable)
        {
            //StructFunctions.objectsStruct myDataTableStruct = new StructFunctions.objectsStruct();
            string TableName = myDataTableStruct.tableName;

            //DataTable myTable = myDataSet.Tables.Add(TableName);
            myTable = myDataSet.Tables.Add(TableName);

            DataColumnCollection TableCols;

            TableCols = myTable.Columns;

            //Primary key GUID
            DataColumn colGuid = TableCols.Add(myDataTableStruct.GUID_fieldName, typeof(Guid));

            colGuid.AllowDBNull  = false;
            colGuid.Unique       = true;
            colGuid.DefaultValue = Guid.NewGuid();
            myTable.PrimaryKey   = new DataColumn[] { colGuid };
            //Fields
            DataColumn colType            = TableCols.Add(myDataTableStruct.Type_fieldName, typeof(int));
            DataColumn colTypeDescription = TableCols.Add(myDataTableStruct.Type_Description_fieldName, typeof(string));
            DataColumn colID          = TableCols.Add(myDataTableStruct.ID_fieldName, typeof(int));
            DataColumn colDescription = TableCols.Add(myDataTableStruct.Description_fieldName, typeof(string));

            DataTableCollection myDataTableColl = myDataSet.Tables;
        }
Ejemplo n.º 2
0
 public DataClass()
 {
     myDataSet        = new DataSet();
     objectTypesTable = new DataTable();
     createObjectTypesTable(ref myDataSet, ref objectTypeStruct, ref objectTypesTable);
     objectTable = new DataTable();
     createObjectsTable(ref myDataSet, ref objectStruct, ref objectTable);
     objectStruct = new StructFunctions.objectsStruct();
 }
Ejemplo n.º 3
0
        public Guid populateObjectRow(ref DataTable myDataTable, StructFunctions.objectsStruct myDataTableStruct)
        {
            DataRow row = myDataTable.NewRow();

            row[myDataTableStruct.GUID_fieldName]             = Guid.NewGuid();
            row[myDataTableStruct.ID_fieldName]               = myDataTableStruct.ID;
            row[myDataTableStruct.Type_fieldName]             = myDataTableStruct.Type;
            row[myDataTableStruct.Type_Description_fieldName] = myDataTableStruct.Type_Description;
            row[myDataTableStruct.Description_fieldName]      = myDataTableStruct.Description;
            myDataTable.Rows.Add(row);
            System.Windows.Forms.MessageBox.Show(myDataTable.Rows.Count.ToString());
            return((Guid)row[myDataTableStruct.GUID_fieldName]);
        }