info_willo
Messages postés31Date d'inscriptionmercredi 8 février 2006StatutMembreDernière intervention21 février 2007 8 févr. 2006 à 13:16
C'est un ordre SQL
Tu dois avoir une connection a la base de données. Dans cette exemple, le nom de la connection c'est "BD_CONNECT"
Dim maRequete as String
Dim Commande As new OleDb.OleDbCommand
' CREATION REQUETE
' SI TU VEUX CREER UNE TABLE
maRequete = "CREATE TABLE nomtable ( nomchamp [type] [NOT NULL] [PRIMARY KEY], [...] ....... [ordre SQL ]
' SI TU VEUX AJOUTER SEULEMENT UN CHAMP
maRequete = "ALTER TABLE nomtable ADD nomchamp [TYPE] [NOT NULL] .... "
Try
' ON EXECUTE LA REQUETE
Commande.CommandText = maRequete
Commande.Connection = BD_CONNECT
Commande.ExecuteNonQuery()
Catch ex As Exception
' EN CAS D ERREUR
MsgBox("La création a échoué !", MsgBoxStyle.Critical, "Attention !")
End Try