Problems with MyQuery and UPDATE
Posted: Wed 25 Apr 2007 13:41
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
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