Accueil > > > EXEMPLE DE CREATION D'UNE BASE DE DONNEES
EXEMPLE DE CREATION D'UNE BASE DE DONNEES
Information sur la source
Description
Il faut juste changer les parametres en fonction de l'application et ca va marcher, et il y a toutes les procedures necessaires pour creer une base de donnees
Source
- Dim db As Database
- Sub test(NBD As String)
- If (Dir(NBD) = "") Then
- Set db = CreateDatabase(NBD, dbLangGeneral)
- If Not db Is Nothing Then
- creer_tables db
- Else
- MsgBox "erreur"
- End If
- End If
- End Sub
- Sub champs(tb As TableDef, nom As String, t As Integer, Optional s As Integer, Optional z As Boolean = True, Optional r As Boolean = False)
- Dim f As Field
- Set f = New Field
- f.Name = nom
- f.Type = t
- If (s <> 0) Then f.Size = s
- tb.Fields.Append f
- f.AllowZeroLength = z
- tb.Fields(nom).Required = r
- End Sub
- Sub indexer(tb As TableDef, nom As String, ref As String, Optional t As Boolean)
- Dim ind As Index
- Set ind = New Index
- ind.Name = nom
- ind.Fields = ref
- ind.Primary = True
- ind.Unique = t
- tb.Indexes.Append ind
- End Sub
-
- Sub creer_produit(db As Database, nom As String)
- Dim tb As New TableDef
- tb.Name = nom
- champs tb, "ref", dbText, 10, True, False
- champs tb, "desig", dbText, 10
- champs tb, "qs", dbInteger
- champs tb, "pu", dbInteger
- indexer tb, "xcode", "ref"
- db.TableDefs.Append tb
- End Sub
- Sub creer_client(db As Database, nom As String)
- Dim tb As New TableDef
- tb.Name = nom
- champs tb, "CIN", dbText, 10
- champs tb, "nom", dbText, 20
- champs tb, "prenom", dbText, 20
- champs tb, "adresse", dbText, 30
- champs tb, "tele", dbInteger, 11
- champs tb, "fax", dbInteger, 20
- indexer tb, "xcode", "CIN"
- db.TableDefs.Append tb
- End Sub
- Sub creer_facture(db As Database, nom As String)
- Dim tb As New TableDef
- tb.Name = nom
- champs tb, "Nfact", dbText, 10
- champs tb, "CIN", dbText, 10
- champs tb, "date", dbDate
- indexer tb, "xcode", "Nfact"
- db.TableDefs.Append tb
- End Sub
- Sub creer_articles(db As Database, nom As String)
- Dim tb As New TableDef
- tb.Name = nom
- champs tb, "Nfact", dbText, 10
- champs tb, "ref", dbText, 10
- champs tb, "q", dbInteger
- indexer tb, "xcode", "Nfact"
- db.TableDefs.Append tb
- End Sub
- Sub creer_tables(db As Database)
- creer_produit db, "produit"
- creer_client db, "client"
- creer_facture db, "facture"
- creer_articles db, "articles"
- End Sub
-
-
-
Dim db As Database
Sub test(NBD As String)
If (Dir(NBD) = "") Then
Set db = CreateDatabase(NBD, dbLangGeneral)
If Not db Is Nothing Then
creer_tables db
Else
MsgBox "erreur"
End If
End If
End Sub
Sub champs(tb As TableDef, nom As String, t As Integer, Optional s As Integer, Optional z As Boolean = True, Optional r As Boolean = False)
Dim f As Field
Set f = New Field
f.Name = nom
f.Type = t
If (s <> 0) Then f.Size = s
tb.Fields.Append f
f.AllowZeroLength = z
tb.Fields(nom).Required = r
End Sub
Sub indexer(tb As TableDef, nom As String, ref As String, Optional t As Boolean)
Dim ind As Index
Set ind = New Index
ind.Name = nom
ind.Fields = ref
ind.Primary = True
ind.Unique = t
tb.Indexes.Append ind
End Sub
Sub creer_produit(db As Database, nom As String)
Dim tb As New TableDef
tb.Name = nom
champs tb, "ref", dbText, 10, True, False
champs tb, "desig", dbText, 10
champs tb, "qs", dbInteger
champs tb, "pu", dbInteger
indexer tb, "xcode", "ref"
db.TableDefs.Append tb
End Sub
Sub creer_client(db As Database, nom As String)
Dim tb As New TableDef
tb.Name = nom
champs tb, "CIN", dbText, 10
champs tb, "nom", dbText, 20
champs tb, "prenom", dbText, 20
champs tb, "adresse", dbText, 30
champs tb, "tele", dbInteger, 11
champs tb, "fax", dbInteger, 20
indexer tb, "xcode", "CIN"
db.TableDefs.Append tb
End Sub
Sub creer_facture(db As Database, nom As String)
Dim tb As New TableDef
tb.Name = nom
champs tb, "Nfact", dbText, 10
champs tb, "CIN", dbText, 10
champs tb, "date", dbDate
indexer tb, "xcode", "Nfact"
db.TableDefs.Append tb
End Sub
Sub creer_articles(db As Database, nom As String)
Dim tb As New TableDef
tb.Name = nom
champs tb, "Nfact", dbText, 10
champs tb, "ref", dbText, 10
champs tb, "q", dbInteger
indexer tb, "xcode", "Nfact"
db.TableDefs.Append tb
End Sub
Sub creer_tables(db As Database)
creer_produit db, "produit"
creer_client db, "client"
creer_facture db, "facture"
creer_articles db, "articles"
End Sub
Historique
- 01 décembre 2004 01:22:36 :
- j'ai enfin ajoute le zip, desolee pour le retard ;)
Sources de la même categorie
Commentaires et avis
|
Derniers Blogs
SESSION SILVERLIGHT 5 3D : SLIDES ET DEMOSSESSION SILVERLIGHT 5 3D : SLIDES ET DEMOS par Groc
Durant les techdays, j'ai eu le plaisir d'animer une session sur Silverlight 5 et la 3D avec Simon Ferquel. Comme promis, voici nos slides et mes démos (celles avec le viper BSG) ici et là. Pour mémoire, les démos utilisent toutes le viper BSG...
Cliquez pour lire la suite de l'article par Groc [TECHDAYS 2012] SESSION WEBMATRIX 2 : LE COUTEAU SUISSE GRATUIT POUR VOS DéVELOPPEMENTS WEB - SLIDES[TECHDAYS 2012] SESSION WEBMATRIX 2 : LE COUTEAU SUISSE GRATUIT POUR VOS DéVELOPPEMENTS WEB - SLIDES par gpommier
Suite à la session que j'ai présenté sur WebMatrix 2, vous pouvez trouver les slides ici, ainsi que les démos en packages nuget : démos1 et démos2 J'en profite pour remercier chaleureusement tous ceux qui sont venus très nombreux à cette sess...
Cliquez pour lire la suite de l'article par gpommier [SHAREPOINT] LES SESSIONS TECHDAYS 2012.[SHAREPOINT] LES SESSIONS TECHDAYS 2012. par Patrick Guimonet
Voici donc pour ceux qui n'ont pas pu venir, ou ceux qui n'ont pas pu toutes les suivre la liste des sessions SharePoint aux TechDays 2012, que je mettrais à jour dès que les liens des vidéo seront disponibles. Ou ici : http...
Cliquez pour lire la suite de l'article par Patrick Guimonet TECHDAYS PARIS 2012 : SESSION PLEINIèRE JOUR 3TECHDAYS PARIS 2012 : SESSION PLEINIèRE JOUR 3 par ROMELARD Fabrice
Speaker: Bernard Ourghanlian Cette session est comme chaque jour transmise en live par BrainSonic, et j'ai donc suivi cette troisième pleinière par ce moyen sur mon iPad . Elle est dédiée comme chaque année à la mise en perspective de l'é...
Cliquez pour lire la suite de l'article par ROMELARD Fabrice MISHRA READER : UN LECTEUR RSS TRèS ZUNE STYLE EN OPEN SOURCE !MISHRA READER : UN LECTEUR RSS TRèS ZUNE STYLE EN OPEN SOURCE ! par Vko
Hier durant une session dédiée aux Techdays 2012, j'ai eu le plaisir d'annoncer la sortie de la Béta 2 de Mishra Reader. C'est quoi ? Pour les utilisateurs, c'est une vraie expérience de lecture de flux RSS sur Windows. Rien à voir avec les produit...
Cliquez pour lire la suite de l'article par Vko
Logiciels
PONAMEDIA PREMIUM - HELLLOOO FLASH DEMO (V8.4)PONAMEDIA PREMIUM - HELLLOOO FLASH DEMO (V8.4)PONAMEDIA TV DEVIENS HELLLOOO FLASH
LA TV SUR VOTRE ORDINATEUR.
Toute une plateforme Multi... Cliquez pour télécharger PONAMEDIA PREMIUM - HELLLOOO FLASH DEMO Academy System (17.2.1.0)ACADEMY SYSTEM (17.2.1.0)Logiciel de gestion des établissements.
- élèves/étudiants (inscription, dossier, absence...)
-... Cliquez pour télécharger Academy System Easy-Planning (1.0.0.1)EASY-PLANNING (1.0.0.1)Basé sur les mêmes principes que MyPlanning, Easy-Planning permet de créer des plannings sous la ... Cliquez pour télécharger Easy-Planning COLLECTOR PLUS (3.00B)COLLECTOR PLUS (3.00B)COLLECTOR PLUS version 3.00B est un logiciel utilisant une base de données alimentée par :
- L... Cliquez pour télécharger COLLECTOR PLUS LettresFaciles 2011 (8.0.0.1)LETTRESFACILES 2011 (8.0.0.1)LettresFaciles est un logiciel facilitant la création et la rédaction de lettres types.
Son inte... Cliquez pour télécharger LettresFaciles 2011
|