Bonjour à tous,
Me revoilà avec ma base de données Delphi/Access. L'un d'entre vous peut-il me dire pourquoi j'ai systématiquement le message bien connu "ADOQuery1: l'ensemble de données n'est pas en Insertion ou Édition" en lançant la procédure ci-dessous sauf si je met en commentaire le segment allant de "if Dm.ADOQuery1.Locate" à "'Contrée non confirmée';" ça commence à me...... mais sérieusement alors !
Merci de m'aider. Amicalement.
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49 procedure TForm1.btnValiderClick(Sender: TObject); begin if lblTitre.caption='Ajouter un contact' then Dm.ADOQuery1.Insert else Dm.ADOQuery1.Edit; Dm.ADOQuery1.FieldByName('Numero').Value:=NumeroEdit.Text; Dm.ADOQuery1.FieldByName('Jour').Value:=DatePicker3.Date; Dm.ADOQuery1.fieldbyname('Debut').value:=DebutMaskEdit.text; Dm.ADOQuery1.fieldbyname('Fin').value:=FinMaskEdit.text; Dm.ADOQuery1.fieldbyname('Bande').value:=BandeEdit.text; Dm.ADOQuery1.FieldByName('Indicatif').Value:=IndicatifEdit.Text; Dm.ADOQuery1.fieldbyname('S_RST').Value:=SRSTEdit.Text; Dm.ADOQuery1.fieldbyname('M_RST').Value:=MRSTEdit.Text; Dm.ADOQuery1.fieldbyname('Mode').Value:=ModeComboBox.Text; Dm.ADOQuery1.fieldbyname('Observations').Value:=ObservationsEdit.Text; Dm.ADOQuery1.fieldbyname('S_QSL').Value:=SQSLEdit.Text; Dm.ADOQuery1.fieldbyname('M_QSL').Value:=MQSLEdit.Text; if Dm.ADOQuery1.Locate('Zone_CQ',DxccEdit.Text,[]) then Label29.Caption := 'Contrée confirmée' Else Label29.Caption := 'Contrée non confirmée'; {if SQSLEdit.Text = 'X' then if Label29.Caption = 'Contrée non confirmée' then Dm.ADOQuery1.fieldbyname('Zone_CQ').Value:=DxccEdit.Text;} Dm.ADOQuery1.Post; Form1.NbContacts.Caption := Format('%d', [Dm.AdoQuery1.RecordCount]); btnAjouter.Visible := False; btnValider.Visible := False; With Dm.AdoQuery1 do begin SQL.Clear; SQL.Add('SELECT * FROM tblContacts'); SQL.Add ('ORDER BY Numero ASC'); Open; Dm.AdoQuery1.Last; NbContacts.Caption := Format('%d', [Dm.AdoQuery1.RecordCount]); end; With Dm.AdoQuery2 do begin SQL.Text := 'SELECT * FROM tblDxcc ORDER BY Numero ASC'; Open; Dm.AdoQuery2.First; end; SV2.Close; end;
Partager