It is difficult to figure what you try to achieve but I see lots of problems in your code.
1) First you have a memory leak in line 20
SQLQuery := TSQLQuery.Create(nil);
This code create new instance of TSQLQuery every time when you call DbUpdate procedure.
Object pascal doesn't have garbage collector so you must free every object that you create.
for example:
SQLQuery := TSQLQuery.Create(nil);
try
...
finally
TSQLQuery.free;
end;
you can see try ... finally block too, to be sure that your object will free even if something goes wrong.
2) there is no need to create and destroy TSqlQuery component for every sql execution. In your case
you can create TSQLQuery as form field and create TSQLQuery only once in FormCreate event.
for example:
Self.FSQLQuery := TSQLQuery.Create(self);
you can see that this code call "TSQLQuery.Create" with self parameter for owner in this case
TSQLQuery will be automatically released together with form.
3)
SQLQuery.Active:=True;
SQLQuery.Open; //<- this is unnecessary this command is same as: "SQLQuery.Active:=True;"
If you look in TDataSet source code you can see this:
procedure TDataSet.Open;
begin
Active:=True;
end;
4) Your SQL doesn't return any records so you need to use TSQLQuery.ExecSQL method instead open.
5) regarding error "Could not convert variant of type (Null) into type (String)"
problem is here: StrToInt(List_Dllbx.KeyValue);
KeyValue property is variant type and current value is "null" but function StrToInt requires string;
6) "calling DbUpdate from mouse down."
Executing SQL every time when somebody make mouse down does not make sense, this make
unnecessary network trafic and database server load. If you have large database tables your application will be frozen during sql execution.
You need to change design of your application to fix this.