Ms Access

Signaler
Messages postés
124
Date d'inscription
mardi 10 mai 2005
Statut
Membre
Dernière intervention
29 mai 2020
-
Public Function CreateDatabase(DatabaseFullPath As String) As Boolean
Dim BAns As Boolean
Dim Cat As New ADOX.Catalog()
Try
Dim sCreateString As String
sCreateString = "Provider = Microsoft.ACE.OLEDB.12.0;Data Source = " & DatabaseFullPath
Cat.Create(sCreateString)
BAns = True

Dim Conx As New OleDb.OleDbConnection
Dim Cmd As New OleDb.OleDbCommand
Conx.ConnectionString = "Provider = Microsoft.ACE.OLEDB.12.0; Data Source = " _
+ "C:\Users\Documents\cardbase.mdf"
Conx.Open()
Cmd.Connection() = Conx

Cmd.CommandText = "CREATE TABLE Cars(ID AUTOINCREMENT CONSTRAINT PKEY Primary Key," & _
" Réf TEXT(20)," & _
" Date_ DATETIME," & _
" Doc TEXT(20)," & _
" TC TEXT(20)," & _
" Mark TEXT(20)," & _
" Typ TEXT(20)," & _
" Ann TEXT(10)," & _
" Img1 XXXXXXXXXXXXXXXX," & _
" Img2 XXXXXXXXXXXXXXXX," & _
" Info MEMO)"
Cmd.ExecuteNonQuery()

Conx.Close()

Catch Excep As System.Runtime.InteropServices.COMException
BAns = False
End Try
Return BAns
End Function

Ma question
comment écrire et remplacer les XXXXX, lorsque je voudrais insérer dans les colonnes Img1 et Img2 des données de types OBJET OLE
--