Her er et eks. Hvordan jeg normalt har en select efterfølgende en update/insert
TEMPOEQuery.SQL.Clear;
TEMPOEQuery.SQL.Add('SELECT *');
TEMPOEQuery.SQL.Add(' FROM '+DBUSERstr+'AKKINFO');
TEMPOEQuery.SQL.Add(' WHERE ID='+ViewSTATIONIDDBText.Field.Text);
Try
TEMPOEQuery.Active;
Case (TEMPOEQuery.RecordCount=0) of
True : Try
TEMPOEQuery.SQL.Clear;
TEMPOEQuery.SQL.Add('INSERT INTO '+DBUSERstr+'AKKINFO');
TEMPOEQuery.SQL.Add(' (ID,KKVPROCEDURE,EQUIPMENT,INSPECTIONDONE)');
TEMPOEQuery.SQL.Add(' VALUES ('+ViewSTATIONIDDBText.Field.Text+','+
#39+AfslutProcedureEdit.text+#39+','+
#39+AfslutEquipmentEdit.text+#39+','+
#39+' '+#39+')');
TEMPOEQuery.ExecSQL;
Except
end;
False : Try
TEMPOEQuery.SQL.Clear;
TEMPOEQuery.SQL.Add('UPDATE '+DBUSERstr+'AKKINFO');
TEMPOEQuery.SQL.Add(' SET KKVPROCEDURE='+#39+AfslutProcedureEdit.text+#39+','+
'EQUIPMENT='+#39+AfslutEquipmentEdit.text+#39);
TEMPOEQuery.SQL.Add(' WHERE ID='+ViewSTATIONIDDBText.Field.Text);
TEMPOEQuery.ExecSQL;
Except
end;
end;
Except
end;
MV.
Peter Jensen