Delphi - SQL-PARÁMETROS

 
Vista:

SQL-PARÁMETROS

Publicado por VITIN (4 intervenciones) el 15/09/2000 00:00:00
Hola, y gracias por prestarme un poco de atención. Mi problema es el siguiente.
Quiero hacer un "update" sobre mi tabla de artículos. En concreto, quiero modificar el
stock de un artículo y necesito pasarle al "update" el código del artículo y la cantidad
de ese artículo. He intentado de todo, pero creo ser algo corto aún en Delphi. Lo último
que intenté fue.

unidades:=strtoint(´90´);
numerartic:=strtoint(´1´);
updatesql1.dataset:=tabla_articulos;
updatesql1.Query[ukModify].SQL.add(´update tb_artic set pkcodi_art_artic=
:pkcodi_art_artic, unidades_artic=: unidades where (t.pkcodi_art_artic=
:numeartic)´);
updatesql1.ExecSQL(ukmodify);
¿qué hago mal?¿qué debería hacer?. Muchas gracias....
Valora esta pregunta
Me gusta: Está pregunta es útil y esta claraNo me gusta: Está pregunta no esta clara o no es útil
0
Responder

RE:SQL-PARÁMETROS

Publicado por VITIN (4 intervenciones) el 19/09/2000 00:00:00
Pues yo mismo he encontrado la solución :-) y aquí os la pongo el código que he usado por si algún día tenéis ese problema...
oper_facturas.QueryRellenarGrid.close;
oper_facturas.QueryRellenarGrid.sql.clear;
{creamos el parámetro}oper_facturas.queryRellenarGrid.params.CreateParam(ftinteger, ´unidades_vendidas´, ptInput);
{le asignamos un valor}oper_facturas.queryRellenarGrid.Params.ParamByName(´unidades_vendidas´).Asinteger := strtoint(edit5.text);
{este es otro parámetro necesario}oper_facturas.queryRellenarGrid.params.CreateParam(ftinteger, ´numeart´, ptInput);
oper_facturas.queryRellenarGrid.Params.ParamByName(´numeart´).Asinteger := strtoint(DBLookUpCombobox2.text);
{y hacemos el update} oper_facturas.queryRellenarGrid.sql.add(´update tb_artic set unidades_artic=unidades_artic-:unidades_vendidas where pkcodi_art_artic=:numeart´);
{ejecutamos}oper_facturas.queryRellenarGrid.execsql;

UN SALUDO!!!!
Valora esta respuesta
Me gusta: Está respuesta es útil y esta claraNo me gusta: Está respuesta no esta clara o no es útil
0
Comentar