|
|||||||
АвтоАвтоматизацияАрхитектураАстрономияАудитБиологияБухгалтерияВоенное делоГенетикаГеографияГеологияГосударствоДомДругоеЖурналистика и СМИИзобретательствоИностранные языкиИнформатикаИскусствоИсторияКомпьютерыКулинарияКультураЛексикологияЛитератураЛогикаМаркетингМатематикаМашиностроениеМедицинаМенеджментМеталлы и СваркаМеханикаМузыкаНаселениеОбразованиеОхрана безопасности жизниОхрана ТрудаПедагогикаПолитикаПравоПриборостроениеПрограммированиеПроизводствоПромышленностьПсихологияРадиоРегилияСвязьСоциологияСпортСтандартизацияСтроительствоТехнологииТорговляТуризмФизикаФизиологияФилософияФинансыХимияХозяйствоЦеннообразованиеЧерчениеЭкологияЭконометрикаЭкономикаЭлектроникаЮриспунденкция |
Приложение №1 SQL запросDim ERwinWorkspace As Workspace Dim ERwinDatabase As Database Dim ERwinTableDef As TableDef Dim ERwinQueryDef As QueryDef Dim ERwinIndex As Index Dim ERwinField As Field Dim ERwinRelation As Relation Set ERwinWorkspace = DBEngine.WorkSpaces(0)
Set ERwinDatabase = ERwinWorkspace.OpenDatabase("sERwinDatabase")
' CREATE TABLE Журнал Set ERwinTableDef = ERwinDatabase.CreateTableDef("Журнал") Set ERwinField = ERwinTableDef.CreateField("ID", DB_LONG) ERwinField.Attributes = ERwinField.Attributes + DB_AUTOINCRFIELD ERwinField.Required = True ERwinTableDef.Fields.Append ERwinField Set ERwinField = ERwinTableDef.CreateField("ФИО", DB_MEMO) ERwinTableDef.Fields.Append ERwinField Set ERwinField = ERwinTableDef.CreateField("История", DB_MEMO) ERwinTableDef.Fields.Append ERwinField Set ERwinField = ERwinTableDef.CreateField("Дата", DB_MEMO) ERwinTableDef.Fields.Append ERwinField ERwinDatabase.TableDefs.Append ERwinTableDef Set ERwinField = ERwinTableDef.Fields("ID") Call SetFieldProp(ERwinField, "Caption", DB_TEXT, "ID:") Set ERwinField = ERwinTableDef.Fields("ФИО") Call SetFieldProp(ERwinField, "Caption", DB_TEXT, "ФИО:") Set ERwinField = ERwinTableDef.Fields("История") Call SetFieldProp(ERwinField, "Caption", DB_TEXT, "История:") Set ERwinField = ERwinTableDef.Fields("Дата") Call SetFieldProp(ERwinField, "Caption", DB_TEXT, "Дата:")
' CREATE INDEX XPKЖурнал Set ERwinTableDef = ERwinDatabase.TableDefs("Журнал") Set ERwinIndex = ERwinTableDef.CreateIndex("XPKЖурнал") Set ERwinField = ERwinIndex.CreateField("ID") ERwinIndex.Fields.Append ERwinField ERwinIndex.Primary = True ERwinTableDef.Indexes.Append ERwinIndex
' CREATE TABLE Журнал выдач Set ERwinTableDef = ERwinDatabase.CreateTableDef("Журнал выдач") Set ERwinField = ERwinTableDef.CreateField("ФИО", DB_MEMO) ERwinTableDef.Fields.Append ERwinField Set ERwinField = ERwinTableDef.CreateField("История", DB_MEMO) ERwinTableDef.Fields.Append ERwinField Set ERwinField = ERwinTableDef.CreateField("IDGurnal", DB_MEMO) ERwinTableDef.Fields.Append ERwinField Set ERwinField = ERwinTableDef.CreateField("ID", DB_LONG) ERwinField.Required = True ERwinTableDef.Fields.Append ERwinField ERwinDatabase.TableDefs.Append ERwinTableDef Set ERwinField = ERwinTableDef.Fields("ФИО") Call SetFieldProp(ERwinField, "Caption", DB_TEXT, "ФИО:") Set ERwinField = ERwinTableDef.Fields("История") Call SetFieldProp(ERwinField, "Caption", DB_TEXT, "История:") Set ERwinField = ERwinTableDef.Fields("IDGurnal") Call SetFieldProp(ERwinField, "Caption", DB_TEXT, "IDGurnal:") Set ERwinField = ERwinTableDef.Fields("ID") Call SetFieldProp(ERwinField, "Caption", DB_TEXT, "ID:")
' CREATE INDEX XPKЖурнал выдач Set ERwinTableDef = ERwinDatabase.TableDefs("Журнал выдач") Set ERwinIndex = ERwinTableDef.CreateIndex("XPKЖурнал выдач") Set ERwinField = ERwinIndex.CreateField("ID") ERwinIndex.Fields.Append ERwinField ERwinIndex.Primary = True ERwinTableDef.Indexes.Append ERwinIndex
' CREATE TABLE Изделия Set ERwinTableDef = ERwinDatabase.CreateTableDef("Изделия") Set ERwinField = ERwinTableDef.CreateField("ID", DB_LONG) ERwinField.Attributes = ERwinField.Attributes + DB_AUTOINCRFIELD ERwinField.Required = True ERwinTableDef.Fields.Append ERwinField Set ERwinField = ERwinTableDef.CreateField("Наименование", DB_MEMO) ERwinTableDef.Fields.Append ERwinField Set ERwinField = ERwinTableDef.CreateField("Повреждение", DB_MEMO) ERwinTableDef.Fields.Append ERwinField Set ERwinField = ERwinTableDef.CreateField("Материал", DB_MEMO) ERwinTableDef.Fields.Append ERwinField Set ERwinField = ERwinTableDef.CreateField("Цвет", DB_MEMO) ERwinTableDef.Fields.Append ERwinField Set ERwinField = ERwinTableDef.CreateField("Стоимость", DB_MEMO) ERwinTableDef.Fields.Append ERwinField Set ERwinField = ERwinTableDef.CreateField("Услуга", DB_MEMO) ERwinTableDef.Fields.Append ERwinField Set ERwinField = ERwinTableDef.CreateField("Наличие", DB_MEMO) ERwinTableDef.Fields.Append ERwinField ERwinDatabase.TableDefs.Append ERwinTableDef Set ERwinField = ERwinTableDef.Fields("ID") Call SetFieldProp(ERwinField, "Caption", DB_TEXT, "ID:") Set ERwinField = ERwinTableDef.Fields("Наименование") Call SetFieldProp(ERwinField, "Caption", DB_TEXT, "Наименование:") Set ERwinField = ERwinTableDef.Fields("Повреждение") Call SetFieldProp(ERwinField, "Caption", DB_TEXT, "Повреждение:") Set ERwinField = ERwinTableDef.Fields("Материал") Call SetFieldProp(ERwinField, "Caption", DB_TEXT, "Материал:") Set ERwinField = ERwinTableDef.Fields("Цвет") Call SetFieldProp(ERwinField, "Caption", DB_TEXT, "Цвет:") Set ERwinField = ERwinTableDef.Fields("Стоимость") Call SetFieldProp(ERwinField, "Caption", DB_TEXT, "Стоимость:") Set ERwinField = ERwinTableDef.Fields("Услуга") Call SetFieldProp(ERwinField, "Caption", DB_TEXT, "Услуга:") Set ERwinField = ERwinTableDef.Fields("Наличие") Call SetFieldProp(ERwinField, "Caption", DB_TEXT, "Наличие:")
' CREATE INDEX XPKИзделия Set ERwinTableDef = ERwinDatabase.TableDefs("Изделия") Set ERwinIndex = ERwinTableDef.CreateIndex("XPKИзделия") Set ERwinField = ERwinIndex.CreateField("ID") ERwinIndex.Fields.Append ERwinField ERwinIndex.Primary = True ERwinTableDef.Indexes.Append ERwinIndex
' CREATE TABLE Клиенты Set ERwinTableDef = ERwinDatabase.CreateTableDef("Клиенты") Set ERwinField = ERwinTableDef.CreateField("Фамилия", DB_MEMO) ERwinTableDef.Fields.Append ERwinField Set ERwinField = ERwinTableDef.CreateField("Имя", DB_MEMO) ERwinTableDef.Fields.Append ERwinField Set ERwinField = ERwinTableDef.CreateField("Отчество", DB_MEMO) ERwinTableDef.Fields.Append ERwinField Set ERwinField = ERwinTableDef.CreateField("ID", DB_LONG) ERwinField.Required = True ERwinTableDef.Fields.Append ERwinField ERwinDatabase.TableDefs.Append ERwinTableDef Set ERwinField = ERwinTableDef.Fields("Фамилия") Call SetFieldProp(ERwinField, "Caption", DB_TEXT, "Фамилия:") Set ERwinField = ERwinTableDef.Fields("Имя") Call SetFieldProp(ERwinField, "Caption", DB_TEXT, "Имя:") Set ERwinField = ERwinTableDef.Fields("Отчество") Call SetFieldProp(ERwinField, "Caption", DB_TEXT, "Отчество:") Set ERwinField = ERwinTableDef.Fields("ID") Call SetFieldProp(ERwinField, "Caption", DB_TEXT, "ID:")
' CREATE INDEX XPKКлиенты Set ERwinTableDef = ERwinDatabase.TableDefs("Клиенты") Set ERwinIndex = ERwinTableDef.CreateIndex("XPKКлиенты") Set ERwinField = ERwinIndex.CreateField("ID") ERwinIndex.Fields.Append ERwinField ERwinIndex.Primary = True ERwinTableDef.Indexes.Append ERwinIndex
' CREATE RELATIONSHIP R/1
Set ERwinRelation = ERwinDatabase.CreateRelation(R/1, Журнал, Журнал выдач) Set ERwinField = ERwinRelation.CreateField("ID") ERwinField.ForeignName = ID ERwinRelation.Fields.Append ERwinField ERwinDatabase.Relations.Append ERwinRelation
' CREATE RELATIONSHIP R/2
Set ERwinRelation = ERwinDatabase.CreateRelation(R/2, Изделия, Клиенты) Set ERwinField = ERwinRelation.CreateField("ID") ERwinField.ForeignName = ID ERwinRelation.Fields.Append ERwinField ERwinDatabase.Relations.Append ERwinRelation
' CREATE RELATIONSHIP R/3
Set ERwinRelation = ERwinDatabase.CreateRelation(R/3, Журнал выдач, Клиенты) Set ERwinField = ERwinRelation.CreateField("ID") ERwinField.ForeignName = ID ERwinRelation.Fields.Append ERwinField ERwinDatabase.Relations.Append ERwinRelation
ERwinDatabase.Close ERwinWorkspace.Close ' Terminating Access Basic DAO Session... Приложение №2 Листинг программы Class1 Imports System.Collections Imports System.Windows.Forms Public Class Class1 Implements System.Collections.IComparer Private ColumnToSort As Integer Private OrderOfSort As SortOrder Private ObjectCompare As CaseInsensitiveComparer Public Sub New() ColumnToSort = 0 OrderOfSort = SortOrder.None ObjectCompare = New CaseInsensitiveComparer() End Sub Public Function Compare(ByVal x As Object, ByVal y As Object) As Integer Implements IComparer.Compare Dim compareResult As Integer Dim listviewX As ListViewItem Dim listviewY As ListViewItem listviewX = CType(x, ListViewItem) listviewY = CType(y, ListViewItem) compareResult = ObjectCompare.Compare(listviewX.SubItems(ColumnToSort).Text, listviewY.SubItems(ColumnToSort).Text) If (OrderOfSort = SortOrder.Ascending) Then Return compareResult ElseIf (OrderOfSort = SortOrder.Descending) Then Return (-compareResult) Else Return 0 End If End Function Public Property SortColumn() As Integer Set(ByVal Value As Integer) ColumnToSort = Value End Set Get Return ColumnToSort End Get End Property Public Property Order() As SortOrder Set(ByVal Value As SortOrder) OrderOfSort = Value End Set Get Return OrderOfSort End Get End Property End Class Поиск по сайту: |
Все материалы представленные на сайте исключительно с целью ознакомления читателями и не преследуют коммерческих целей или нарушение авторских прав. Студалл.Орг (0.016 сек.) |