Example #1
0
        public void createObjectTypesTable(ref DataSet myDataSet, ref StructFunctions.objectTypesStruct myDataTableStruct, ref DataTable myTable)
        {
            //StructFunctions.objectTypesStruct myDataTableStruct = new StructFunctions.objectTypesStruct();
            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));

            DataTableCollection myDataTableColl = myDataSet.Tables;
        }
Example #2
0
        public Guid populateObjectTypeRow(ref DataTable myDataTable, StructFunctions.objectTypesStruct myDataTableStruct)
        {
            DataRow row = myDataTable.NewRow();

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