Besoin d'aide avec VB6 et SQL

Résolu
samag Messages postés 10 Date d'inscription mercredi 4 août 2004 Statut Membre Dernière intervention 3 septembre 2004 - 3 sept. 2004 à 12:07
crn_c21 Messages postés 302 Date d'inscription samedi 24 janvier 2004 Statut Membre Dernière intervention 4 février 2011 - 3 sept. 2004 à 14:45
Voici mon code de base:create table AGV
(CODEAGV numeric(10) not null,
REF char(20) not null,
UTILISATEUR char(6) null ,
TYPOPER char(1) null ,
DATOPER datetime null ,
OBSERVATION char(250) null ,
OFFID char(10) null ,
NOM_AGV char(20) null ,
FAX char(20) null ,
TEL char(20) null ,
VILLE char(20) null ,
DIRECTION char(20) null ,
AGVDATEINST datetime null ,
AGVSTATUS char(20) null ,
constraint PK_AGV primary key (CODEAGV) )
ma requete ne marche pas:strsql = "Insert into AGV (CODEAGV,REF,UTILISATEUR,TYPOPER,DATOPER,OBSERVATION,OFFID,NOM_AGV,FAX,TEL,VILLE,DIRECTION,AGVSTATUS,AGVDATEINST) values ('" & txt1 & "','" & txt2 & "','" & txt3 & "',getdate(),'" & txt5 & "','" & txt6 & "','" & txt7 & "','" & txt8 & "','" & txt9 & "','" & txt10 & "','" & txt11 & "','" & txt12 & "','" & txt14 & "','" & txt13 & "' )"

6 réponses

crn_c21 Messages postés 302 Date d'inscription samedi 24 janvier 2004 Statut Membre Dernière intervention 4 février 2011
3 sept. 2004 à 14:45
Pfffff

il faut INSERT INTO à la place de INSERT
3
crn_c21 Messages postés 302 Date d'inscription samedi 24 janvier 2004 Statut Membre Dernière intervention 4 février 2011
3 sept. 2004 à 12:16
Ne pas mettre de ' pour ajouter une variable dans un champ numerique!

strsql = "Insert into AGV (CODEAGV,REF,UTILISATEUR,TYPOPER,DATOPER,OBSERVATION,OFFID,NOM_AGV,FAX,TEL,VILLE,DIRECTION,AGVSTATUS,AGVDATEINST) values (" & txt1 & ",'" & txt2 & "','" & txt3 & "',getdate(),'" & txt5 & "','" & txt6 & "','" & txt7 & "','" & txt8 & "','" & txt9 & "','" & txt10 & "','" & txt11 & "','" & txt12 & "','" & txt14 & "','" & txt13 & "' )"
0
samag Messages postés 10 Date d'inscription mercredi 4 août 2004 Statut Membre Dernière intervention 3 septembre 2004
3 sept. 2004 à 12:46
Ca ne marche pas .Il m'affiche toujours

Erreur d'execution '-2147217913 (80040e07)':
Erreur de conversion du type de données varchar en numéric.
0
crn_c21 Messages postés 302 Date d'inscription samedi 24 janvier 2004 Statut Membre Dernière intervention 4 février 2011
3 sept. 2004 à 12:53
excuse moi!

strsql = "Insert into AGV (CODEAGV,REF,UTILISATEUR,TYPOPER,DATOPER,OBSERVATION,OFFID,NOM_AGV,FAX,TEL,VILLE,DIRECTION,AGVSTATUS,AGVDATEINST) values (" & convert(integer,txt1) & ",'" & txt2 & "','" & txt3 & "',getdate(),'" & txt5 & "','" & txt6 & "','" & txt7 & "','" & txt8 & "','" & txt9 & "','" & txt10 & "','" & txt11 & "','" & txt12 & "','" & txt14 & "','" & txt13 & "' )"
0

Vous n’avez pas trouvé la réponse que vous recherchez ?

Posez votre question
samag Messages postés 10 Date d'inscription mercredi 4 août 2004 Statut Membre Dernière intervention 3 septembre 2004
3 sept. 2004 à 13:23
VB6 n'accepte pas
Erreur de compilation attendu: expression
Merci d'avance
0
samag Messages postés 10 Date d'inscription mercredi 4 août 2004 Statut Membre Dernière intervention 3 septembre 2004
3 sept. 2004 à 13:33
strsql = "(Insert into AGV (CODEAGV,REF,UTILISATEUR,TYPOPER,DATOPER,OBSERVATION,OFFID,NOM_AGV,FAX,TEL,VILLE,DIRECTION,AGVSTATUS,AGVDATEINST) values (" & convert(Numeric, txt1) & ",'" & txt2 & "','" & txt3 & "',getdate(),'" & txt5 & "','" & txt6 & "','" & txt7 & "','" & txt8 & "','" & txt9 & "','" & txt10 & "','" & txt11 & "','" & txt12 & "','" & txt14 & "','" & txt13 & "' ))"
celle ci marche mais ne résouds pas le problème
0
Rejoignez-nous