Hello, I have a Myquery(called Query Update) component, and need to update a field in my Table. The code in myquery is:
UPDATE productos // Table
SET stock=stock // stock is a parameter
WHERE codigo=codigo // codigo ia a parameter
Stock and Codigo are written in 2 DBedits to modify te table.
Later, I have a Button to execute mi code:
QueryUpdate.Close;
QueryUpdate.SQL.Clear;
QueryUpdate.SQL.Text:=('UPDATE productos SET stock='+txtstock.Text);
QueryUpdate.SQL.Text:=('WHERE codigo='+DBstock.Text);
Showmessage(Queryupdate.SQL.Text);
MyTable1.Refresh;
QueryUpdate.Open;
But, I have a mistake, because mi code, does't change the information that corresponds.
I think that have problems with myquery.
Ps. Thank you, and sorry for mi english
Problems with MyQuery and UPDATE
In order to execute commands that do not return result sets (INSERT, UPDATE, DELETE, etc.), you should call the TMyQuery.Execute instead of TMyQuery.Open.
Turn on the debug mode for QueryUpdate (add MyDACVCL unit to the uses clause and set the QueryUpdate.Debug property to True) and check what query is sent to the server.
Turn on the debug mode for QueryUpdate (add MyDACVCL unit to the uses clause and set the QueryUpdate.Debug property to True) and check what query is sent to the server.
-
EdderU2RSE
- Posts: 10
- Joined: Tue 17 Apr 2007 19:47
Ok thaks
Thaks for help me.
My problem was solve susscefully
PS Thaks
sorry for mi english
My problem was solve susscefully
PS Thaks
sorry for mi english