AYUDA EN LÍNEA
 WINDEVWEBDEV Y WINDEV MOBILE

Ayuda / WLanguage / Administrar bases de datos / Funciones SQL
  • Example: Updating a connected database
SQLModify (Example)
Example: Updating a connected database
WINDEVWEBDEV - Código ServidorReportes y ConsultasWindowsCódigo de Usuario (UMC)AjaxHyper File 5.5OLE DBODBC This example uses a procedure to update a connected database.
// Procedure for updating the connected database
PROCEDURE ModCustomer
Res is boolean
QueryU, Query is string
Res = SQLExec("SELECT CUSTNUM, ZIP, CITY FROM CUSTOMER", "QRYSELECT")
IF Res = False THEN
// Process the error
END
SQLAssociate("QRYSELECT", CustomerNum, ZipCode, City)
// Update all the customers
SQLFirst("QRYSELECT")
WHILE NOT SQL.Out
IF City = "MONTPELLIER" THEN
// Run a modification query on the database
  QueryU = "UPDATE CUSTOMER SET ZIPCODE='34000'" + ...
 "WHERE CUSTNUM=" + CustomerNum
  // Execute query
  SQLExec(QueryU, "QRYUPDATE")
  // Update the associated table
  SQLInfo("QRYSELECT")
  // Same modification on the result
  // in order to not re-run the select query
  Query = CustomerNum + TAB + "34000" + TAB + City
  SQLModify("QRYSELECT", SQL.Current, Query)
  END
SQLNext("QRYSELECT")
END
Versión mínima requerida
  • Versión 9
Esta página también está disponible para…
Comentarios
Haga clic en [Agregar] para publicar un comentario

Última modificación: 27/05/2022

Señalar un error o enviar una sugerencia | Ayuda local