Thema: Delphi SQL problem

Einzelnen Beitrag anzeigen

nanix
(Gast)

n/a Beiträge
 
#1

SQL problem

  Alt 7. Dez 2009, 12:51
Datenbank: SQL • Zugriff über: SQL
Hi

i wrote this code this morning but apparently my SQL knowledge is too short for this.Why it won't add records


Delphi-Quellcode:
for hwm_index := 0 to NBMonitors - 1 do begin
CPUIDSDK_GetHardwareMonitorName(hwm_index, ptrName);
ABSQuery1.SQL.Clear;
ABSQuery1.SQL.Add('Insert into Sensors (Field,HWM_ID,Sensor_ID,Sensor_Class,Monitor_Name) values ( :Field, :hwm_id, :sensor_id,:sensor_class,:Monitor_Name );');
ABSQuery1.ExecSQL;

for sensor_index := 0 to CPUIDSDK_GetNumberOfSensors(hwm_index, SENSOR_CLASS_VOLTAGE) - 1 do begin
ABSQuery1.ParamByName('HWM_ID').AsString:=inttostr(hwm_index);
ABSQuery1.ParamByName('Monitor_Name').AsString:=pansichar(ptrname);
ABSQuery1.ParamByName('Sensor_ID').AsString:=inttostr(sensor_index);
ABSQuery1.ParamByName('Sensor_Class').AsString:=inttostr(SENSOR_CLASS_VOLTAGE);
end;

for sensor_index := 0 to CPUIDSDK_GetNumberOfSensors(hwm_index, SENSOR_CLASS_TEMPERATURE) - 1 do begin
ABSQuery1.ParamByName('HWM_ID').AsString:=inttostr(hwm_index);
ABSQuery1.ParamByName('Monitor_Name').AsString:=pansichar(ptrname);
ABSQuery1.ParamByName('Sensor_ID').AsString:=inttostr(sensor_index);
ABSQuery1.ParamByName('Sensor_Class').AsString:=inttostr(SENSOR_CLASS_TEMPERATURE);
end;

for sensor_index := 0 to CPUIDSDK_GetNumberOfSensors(hwm_index, SENSOR_CLASS_FAN) - 1 do begin
ABSQuery1.ParamByName('HWM_ID').AsString:=inttostr(hwm_index);
ABSQuery1.ParamByName('Monitor_Name').AsString:=pansichar(ptrname);
ABSQuery1.ParamByName('Sensor_ID').AsString:=inttostr(sensor_index);
ABSQuery1.ParamByName('Sensor_Class').AsString:=inttostr(SENSOR_CLASS_FAN);
end;
end;




end;

ABSQuery1.ExecSQL; on every loop did the trick
  Mit Zitat antworten Zitat