![]() |
Re: SQL problem
No code compiles runs OK no errors.But ofcourse all functions work becouse previously some same functions are used to INSERT records :oops:
1.Set all parameters;
Delphi-Quellcode:
2.Then populate the variables;
ABSQuery1.ParamByName('HWM_ID').AsString:=inttostr(hwm_index);
ABSQuery1.ParamByName('Sensor_Class').AsString:=inttostr(SENSOR_CLASS_VOLTAGE); ABSQuery1.ParamByName('Sensor_ID').AsString:=inttostr(sensor_index);
Delphi-Quellcode:
3.Execute SQL script;
sField:=pansichar(ptrname);
sValue:=Format('%.3f V', [Value]); sMin:=Format('%.3f V', [Min]); sMax:=Format('%.3f V', [Max]);
Delphi-Quellcode:
ABSQuery1.ExecSQL;
I am speculating the SQL text... :| |
Re: SQL problem
Conversion is not needed
Delphi-Quellcode:
You could use here parameters too:
ABSQuery1.ParamByName('HWM_ID').Value := hwm_index);
ABSQuery1.ParamByName('Sensor_Class').Value := SENSOR_CLASS_VOLTAGE; ABSQuery1.ParamByName('Sensor_ID').Value := sensor_index;
SQL-Code:
UPDATE Sensors SET Field = :field ,value = :Value, Min = :min, Max = :max WHERE HWM_ID = :HWM_ID and Sensor_Class = :Sensor_Class and Sensor_ID = :Sensor_ID';
|
Re: SQL problem
I tryed executing after and it makes no diffrence :(
Delphi-Quellcode:
for hwm_index := 0 to NBMonitors - 1 do begin
for sensor_index := 0 to CPUIDSDK_GetNumberOfSensors(hwm_index, SENSOR_CLASS_VOLTAGE) - 1 do begin if CPUIDSDK_GetSensorInfos(hwm_index, sensor_index, SENSOR_CLASS_VOLTAGE, ptrName, iValue, Value, Min, Max) then begin ABSQuery1.ParamByName('HWM_ID').AsString:=inttostr(hwm_index); ABSQuery1.ParamByName('Sensor_Class').AsString:=inttostr(SENSOR_CLASS_VOLTAGE); ABSQuery1.ParamByName('Sensor_ID').AsString:=inttostr(sensor_index); sField:=pansichar(ptrname); sValue:=Format('%.3f V', [Value]); sMin:=Format('%.3f V', [Min]); sMax:=Format('%.3f V', [Max]); ABSQuery1.SQL.Clear; ABSQuery1.SQL.Text := 'UPDATE Sensors SET Field="' +sField+'"' +','+'Value="'+sValue+'"'+','+'Min="'+sMin+'"'+','+'Max="'+sMax+'"'+' WHERE HWM_ID = :HWM_ID and Sensor_Class = :Sensor_Class and Sensor_ID = :Sensor_ID'; ABSQuery1.ExecSQL; Edit1.Text:=ABSQuery1.SQL.Text; end; end; end; end; |
Re: SQL problem
Try parameters
|
Re: SQL problem
Zitat:
Maybe the parameter '%.3f' breaks the function (doen't know, never worked with Format)? |
Re: SQL problem
No i get this in edit1
SQL-Code:
and it says this even tho its on timer 1 s interval :x
UPDATE Sensors SET Field="VIN3",Value="1.536 V",Min="1.536 V",Max="1.536 V" WHERE HWM_ID = :HWM_ID and Sensor_Class = :Sensor_Class and Sensor_ID = :Sensor_ID
|
Re: SQL problem
Ok then i would guess its a database issue. What are the values of the parameters (:HWM_ID,...)? Are there database entries which match these? Because no match with "WHERE" - no update ;-)
|
Re: SQL problem
Liste der Anhänge anzeigen (Anzahl: 1)
I uploaded unit and db file i use its ABSOLUTE DATABASE.
|
Re: SQL problem
Sorry, but I don't know Absolute DB and how to use it. Can't you just lookup if your DB contains entries which match the parameters? Maybe you have something like a management tool for this kind of DB?
|
Re: SQL problem
|
Alle Zeitangaben in WEZ +1. Es ist jetzt 03:17 Uhr. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024 by Thomas Breitkreuz