问题
I've successfully connected LibreOffice Base with MySQL data base server. I've tested if I modify my table from host (free hosting service on internet) then the changes are reflected when refreshing the table object in LO Base. But my question is, can I modify DB table directly from LO Base? I guess that it's possible using sql queries from LO Base, but how? Please give me some insights or tutorials. Thanks.
回答1:
The normal way to alter a table:
- Tools -> SQL
- Enter an
ALTER TABLE
command and pressExecute
button.
A way that works, even though it complains that no result set is returned:
- Create a query in SQL view.
- Enter
ALTER TABLE
command. - Click button in toolbar to mark it as
Run SQL command directly
. Or Edit ->Run SQL command directly
. - Close the query and double-click to run it.
My guess is it could be done with a macro as well, similar to https://forum.openoffice.org/en/forum/viewtopic.php?f=5&t=75763 but using ALTER TABLE
.
For more ideas see https://forum.openoffice.org/en/forum/viewtopic.php?f=61&t=37687.
EDIT:
Inserting new row data in a form is easier than altering the table. First, make sure this works:
- Double-click on your table under
Tables
. - Insert -> Record, or enter data in the last new row.
If Insert -> Record is disabled, then you need to set up the table for editing. Make sure that your connection to the database allows editing. Also the table must have a primary key.
Once you can insert records in Table view, it's time to create the form:
- Under
Forms
,Use Wizard to Create Form
. - Select your table and press
>>
to include all fields. - Click
Finish
.
Now you should be able to open the form and enter data into the final new row.
More complete instructions with examples are at http://www.open-of-course.org/courses/mod/url/view.php?id=786.
来源:https://stackoverflow.com/questions/33704631/modifying-table-entries-from-libreoffice-base-possible