Twitter iPhone pliant OnePlus 11 PS5 Disney+ Orange Livebox Windows 11

problème avec insert dans access 97

1 réponse
Avatar
d.pascal
bonsoir à tous, je ne parviens pas à faire un insert en Access 97.

Je ne me souviens plus comment faire pour que vb6 a accepte les bases
access 2000.

j'ai retourné le code sous toutes ses formes.

Pourriez-vous m'aider ??

Code:


Dim SQLInsertPatient As String
Dim Table_RechercheInsertPatient As Recordset
Dim LaDate As String
Dim LaTime As String

modBase2.connectiondbPATIENTS97

LaDate = Date
LaTime = Time

' on insère dans la table Patients de la BDD PATIENTS97 les infos
receuillis
' champs : Date, Heure, Nompatient, Prenompatient, Adressepatient1,
adressepatient2, Codepostalpatient, Villepatient, Telephonepatient,
Portablepatient, Emailpatient


SQLInsertPatient = "INSERT INTO Patients
(Date,Heure,Nompatient,Prenompatient,Adressepatient,Codepostalpatient,Villepatient,Telephonepatient,Portablepatient,Emailpatient)
VALUES ('LaDate', 'LaTime', 'Nom', 'Prenom', 'Adresse', 'CodePostal',
'Ville', 'Telephone', 'Portable', 'Email') ;"

'Set Table_RechercheInsertPatient =
modBase2.dbPATIENTS97.OpenRecordset(SQLInsertPatient)



modBase2.deconnectdbPATIENTS97

1 réponse

Avatar
Eric
(zheng) écrivait
news::

bonsoir à tous, je ne parviens pas à faire un insert en Access 97.

Je ne me souviens plus comment faire pour que vb6 a accepte les bases
access 2000.

j'ai retourné le code sous toutes ses formes.

Pourriez-vous m'aider ??

Code:


Dim SQLInsertPatient As String
Dim Table_RechercheInsertPatient As Recordset
Dim LaDate As String
Dim LaTime As String

modBase2.connectiondbPATIENTS97

LaDate = Date
LaTime = Time

' on insère dans la table Patients de la BDD PATIENTS97 les infos
receuillis
' champs : Date, Heure, Nompatient, Prenompatient, Adressepatient1,
adressepatient2, Codepostalpatient, Villepatient, Telephonepatient,
Portablepatient, Emailpatient


SQLInsertPatient = "INSERT INTO Patients
(Date,Heure,Nompatient,Prenompatient,Adressepatient,Codepostalpatient,V
illepatient,Telephonepatient,Portablepatient,Emailpatient) VALUES
('LaDate', 'LaTime', 'Nom', 'Prenom', 'Adresse', 'CodePostal',
'Ville', 'Telephone', 'Portable', 'Email') ;"

'Set Table_RechercheInsertPatient > modBase2.dbPATIENTS97.OpenRecordset(SQLInsertPatient)



modBase2.deconnectdbPATIENTS97




Bonjour

Je suppose que tu récupères les valeurs à partir de contrôles du
formulaire, donc il faudrait modifier ton sql pour passer les variables.

SQLInsertPatient="INSERT INTO Patients
(Date,Heure,Nompatient,Prenompatient,Adressepatient,Codepostalpatient,Vil
lepatient,Telephonepatient,Portablepatient,Emailpatient) VALUES(" &
Format(LaDate,"#mm-dd-yyyy#") & ",'" & Nom & "','" & Prenom ... & "';"

La requête étant une requête Action tu dois utiliser la méthode Execute
modBase2.dbPATIENTS97.Execute SQLInsertPatient


A+

Eric