Разработка базы данных библиотечного фонда города, страница 5

Call AddFieldToTable("god", dbInteger, 0, 0, "", "", "", FALSE, FALSE )

Call AddFieldToTable("ID_chit_zala", dbInteger, 0, 0, "", "", "", FALSE, FALSE )

dbs.TableDefs.Append tdf

End Sub

'== Create table Polka ======

Sub CreateTable12()

Set tdf = dbs.CreateTableDef( "Polka" )

Call AddFieldToTable("n_polki", dbInteger, 0, 0, "", "", "", TRUE, FALSE )

Call AddFieldToTable("n_stela_a", dbInteger, 0, 0, "", "", "", FALSE, FALSE )

Call AddFieldToTable("nach_n", dbInteger, 0, 0, "", "", "", FALSE, FALSE )

Call AddFieldToTable("konech_n", dbInteger, 0, 0, "", "", "", FALSE, FALSE )

dbs.TableDefs.Append tdf

End Sub

' Create primary keys

'=====================

Sub CreatePrimaryKeys()

'=== Create primary key for table Formyl_r ======

Set tdf = dbs.TableDefs( "Formyl_r" )

Set idx = tdf.CreateIndex( "pk_Formyl_r" )

idx.Primary = True

idx.Unique  = True

idx.IgnoreNulls = False

Call AddFieldToIndex( "Chet_k", False )

tdf.Indexes.Append idx

'=== Create primary key for table Sotrydniki ======

Set tdf = dbs.TableDefs( "Sotrydniki" )

Set idx = tdf.CreateIndex( "pk_Sotrydniki" )

idx.Primary = True

idx.Unique  = True

idx.IgnoreNulls = False

Call AddFieldToIndex( "ID_sotrydnika", False )

tdf.Indexes.Append idx

'=== Create primary key for table Chitayel_ ======

Set tdf = dbs.TableDefs( "Chitayel_" )

Set idx = tdf.CreateIndex( "pk_Chitayel_" )

idx.Primary = True

idx.Unique  = True

idx.IgnoreNulls = False

Call AddFieldToIndex( "n_chit_bileta", False )

tdf.Indexes.Append idx

'=== Create primary key for table Chitateli ======

Set tdf = dbs.TableDefs( "Chitateli" )

Set idx = tdf.CreateIndex( "pk_Chitateli" )

idx.Primary = True

idx.Unique  = True

idx.IgnoreNulls = False

Call AddFieldToIndex( "ID_kategorii", False )

tdf.Indexes.Append idx

'=== Create primary key for table Chitat_zal ======

Set tdf = dbs.TableDefs( "Chitat_zal" )

Set idx = tdf.CreateIndex( "pk_Chitat_zal" )

idx.Primary = True

idx.Unique  = True

idx.IgnoreNulls = False

Call AddFieldToIndex( "ID_zala", False )

tdf.Indexes.Append idx

'=== Create primary key for table chitatel_v_zale ======

Set tdf = dbs.TableDefs( "chitatel_v_zale" )

Set idx = tdf.CreateIndex( "pk_chitatel_v_zale" )

idx.Primary = True

idx.Unique  = True

idx.IgnoreNulls = False

Call AddFieldToIndex( "Chet_k", False )

tdf.Indexes.Append idx

'=== Create primary key for table Znania ======

Set tdf = dbs.TableDefs( "Znania" )

Set idx = tdf.CreateIndex( "pk_Znania" )

idx.Primary = True

idx.Unique  = True

idx.IgnoreNulls = False

Call AddFieldToIndex( "kod_oblasti_znania", False )

tdf.Indexes.Append idx

'=== Create primary key for table Ekzempl_knigi ======

Set tdf = dbs.TableDefs( "Ekzempl_knigi" )

Set idx = tdf.CreateIndex( "pk_Ekzempl_knigi" )

idx.Primary = True

idx.Unique  = True

idx.IgnoreNulls = False

Call AddFieldToIndex( "Invent_n", False )

tdf.Indexes.Append idx

'=== Create primary key for table Kniga_jyrnal_ ======

Set tdf = dbs.TableDefs( "Kniga_jyrnal_" )

Set idx = tdf.CreateIndex( "pk_Kniga_jyrnal_" )

idx.Primary = True

idx.Unique  = True

idx.IgnoreNulls = False

Call AddFieldToIndex( "ID_knigi", False )

tdf.Indexes.Append idx

'=== Create primary key for table Gazeta ======

Set tdf = dbs.TableDefs( "Gazeta" )

Set idx = tdf.CreateIndex( "pk_Gazeta" )

idx.Primary = True

idx.Unique  = True

idx.IgnoreNulls = False

Call AddFieldToIndex( "ID_gazeta", False )