Posts: 50
Threads: 18
Likes Received: 30 in 20 posts
Likes Given: 0
Joined: Jun 2024
Reputation:
0
Hallo zusammen,
Ich würde gerne mit LDDataBase.EditTable(database, table, dataview) gleich zwei Tabellen gleichzeitig bearbeiten. Ist das möglich?
Posts: 560
Threads: 17
Likes Received: 185 in 154 posts
Likes Given: 304
Joined: Sep 2023
Reputation:
9
Yes, that's an interesting question.
Posts: 635
Threads: 40
Likes Received: 474 in 329 posts
Likes Given: 252
Joined: Aug 2023
Reputation:
25
03-23-2025, 08:32 AM
(This post was last modified: 03-23-2025, 02:06 PM by litdev.)
Hi,
"I would like to edit two tables simultaneously using LDDataBase.EditTable(database, table, dataview). Is that possible?"
I guess it depends exactly on what you mean, here is an example of 2 databases being edited at the same time - is this what you mean?
Code: DBFile1 = Program.Directory+"\DB1.db"
DB1 = LDDataBase.ConnectSQLite(DBFile1)
command = "BEGIN TRANSACTION;"
command = command + "DROP TABLE IF EXISTS Cars;"
command = command + "CREATE TABLE Cars(Id INTEGER PRIMARY KEY, Name TEXT, Cost NUM);"
command = command + "INSERT INTO Cars(Name,Cost)VALUES('Audi','52642');"
command = command + "INSERT INTO Cars(Name,Cost)VALUES('Mercedes','57127');"
command = command + "INSERT INTO Cars(Name,Cost)VALUES('Skoda','9000');"
command = command + "COMMIT;"
LDDataBase.Command(DB1,command)
DBFile2 = Program.Directory+"\DB2.db"
DB2 = LDDataBase.ConnectSQLite(DBFile2)
command = "BEGIN TRANSACTION;"
command = command + "DROP TABLE IF EXISTS People;"
command = command + "CREATE TABLE People(Id INTEGER PRIMARY KEY, Name TEXT, Age NUM);"
command = command + "INSERT INTO People(Name,Age)VALUES('Fred','12');"
command = command + "INSERT INTO People(Name,Age)VALUES('James','33');"
command = command + "INSERT INTO People(Name,Age)VALUES('Mary','21');"
command = command + "COMMIT;"
LDDataBase.Command(DB2,command)
GraphicsWindow.Show()
DV1 = LDControls.AddDataView(240, 350, "")
Shapes.Move(DV1,0,0)
LDDataBase.EditTable(DB1, "Cars", DV1)
DV2 = LDControls.AddDataView(240, 350, "")
Shapes.Move(DV2,250,0)
LDDataBase.EditTable(DB2, "People", DV2)
Posts: 394
Threads: 38
Likes Received: 149 in 116 posts
Likes Given: 259
Joined: Dec 2023
Reputation:
7
Arre they working on same time litdev I think it can be done by threading or async only
ZS
Posts: 635
Threads: 40
Likes Received: 474 in 329 posts
Likes Given: 252
Joined: Aug 2023
Reputation:
25
(03-23-2025, 10:45 AM)z-s Wrote: Arre they working on same time litdev I think it can be done by threading or async only
I guess a user can only edit one at a time so it depends what Martmen is actually trying to do, so if he can provide more details we can see where this leads.
Posts: 50
Threads: 18
Likes Received: 30 in 20 posts
Likes Given: 0
Joined: Jun 2024
Reputation:
0
03-29-2025, 07:22 AM
(This post was last modified: 03-29-2025, 07:31 AM by martmen.)
Es ist eine Datenbank mit zwei Tabellen. Beide Tabellen sollen zur selben Zeit auf dem Bildschirm bearbeitet werden. Editiere ich beide Tabellen und speichere über LDDataBase.SaveTable(database,dataview) jede Tabelle, gehen Informationen einer der Tabellen verloren. So ist die Frage gemeint.
Hallo hier ist ein noch nicht fertiges Programm, um Datenbanken in sqlite zu bearbeiten.
55.000 PSSM
Posts: 394
Threads: 38
Likes Received: 149 in 116 posts
Likes Given: 259
Joined: Dec 2023
Reputation:
7
Posts: 50
Threads: 18
Likes Received: 30 in 20 posts
Likes Given: 0
Joined: Jun 2024
Reputation:
0
Bitte verwenden Sie zum Importieren in "small basic" LSBC640.000
Posts: 76
Threads: 9
Likes Received: 49 in 34 posts
Likes Given: 33
Joined: Sep 2023
Reputation:
9
The import code pssm55.000 works, although it is actually too short!
Posts: 635
Threads: 40
Likes Received: 474 in 329 posts
Likes Given: 252
Joined: Aug 2023
Reputation:
25
Hi Martmen,
This is my test program (BNDW150.000) that has one databse with 2 tables displayed on the GW. If I make changes to them and Save, then both tables are written to the database. We can see this with the Load option, or you can actually look at the database file contents with a tool like the one I use https://sqlitebrowser.org.
I hope this helps - the trick is to save and load both tables - I use my test case rather than your file just to keep it simple and focussed on the exact issue you describe.
|