Macros/Base/ba002

    From The Document Foundation Wiki
    < Macros‎ | Base
    This page is a translated version of the page Macros/Base/ba002 and the translation is 100% complete.
    Other languages:

    Descrizione

    Esegue un aggiornamento nel database corrente

    Sub main()
        doc = ThisComponent
        conn = doc.DataSource.getConnection("", "")
    
        sql = "UPDATE ""contactos"" SET ""numbers""=TRIM(""numbers"")"
        cursor = conn.prepareStatement(sql)
        result = cursor.executeUpdate()
        doc.store()
        MsgBox result
    End Sub
    def main():
        doc = XSCRIPTCONTEXT.getDocument()
        conn = doc.DataSource.getConnection('', '')
    
        sql = 'UPDATE "contactos" SET "numbers"=TRIM("numbers")'
        cursor = conn.prepareStatement(sql)
        result = cursor.executeUpdate()
        doc.store()
        print(result)  # silent if Python console is absent
        return

    Note pin.svg

    Nota:
    Input/Output a schermo aiuta a superare l'assenza dell'output standard di Python. Gli script Python possono essere prototipati utilizzando la shell Python e il suo meccanismo Read Execute Print Loop (REPL). Fare riferimento a Output sulle console per abilitare tale funzionalità

    Note