TheSQL.InitializeSQLite(File.DirApp, "db.db", True)
Dim Fields As Map
Fields.Initialize
Fields.Put("Name", "TEXT")
Dim ListOfMaps As List
ListOfMaps.Initialize
Dim M As Map
M.Initialize
M.Put("Name", "Olimar")
M.Put("Name", "Louie")
M.Put("Name", "Alph")
ListOfMaps.Add(M)
DBUtils.CreateTable(TheSQL, "Name", Fields , "Key")
DBUtils.InsertMaps(TheSQL, "Name", ListOfMaps)
DBUtils.ExecuteTableView(TheSQL, "SELECT Name FROM Name", Null, 1, TableView1)
Code doesn't insert all three keys. Already tried a "For" statement. Doesn't work. TableView1 only displays Alph.
You overwrite the key "Name" always, so only the last record will insert.
B4X:
Dim M As Map
M.Initialize
M.Put("Name", "Olimar")
ListOfMaps.Add(M)
Dim M As Map
M.Initialize
M.Put("Name", "Louie")
ListOfMaps.Add(M)
Dim M As Map
M.Initialize
M.Put("Name", "Alph")
ListOfMaps.Add(M)
You overwrite the key "Name" always, so only the last record will insert.
B4X:
Dim M As Map
M.Initialize
M.Put("Name", "Olimar")
ListOfMaps.Add(M)
Dim M As Map
M.Initialize
M.Put("Name", "Louie")
ListOfMaps.Add(M)
Dim M As Map
M.Initialize
M.Put("Name", "Alph")
ListOfMaps.Add(M)
Dim Fields As Map
Fields.Initialize
Fields.Put("Name", "TEXT")
Dim ListOfMaps As List
ListOfMaps.Initialize
Dim M As Map
M.Initialize
M.Put("Name", "Olimar")
ListOfMaps.Add(M)
Dim M As Map
M.Initialize
M.Put("Name", "Louie")
ListOfMaps.Add(M)
Dim M As Map
M.Initialize
M.Put("Name", "Alph")
ListOfMaps.Add(M)
DBUtils.CreateTable(TheSQL, "Name", Fields , "Key")
DBUtils.InsertMaps(TheSQL, "Name", ListOfMaps)
DBUtils.ExecuteTableView(TheSQL, "SELECT Name FROM Name", Null, 1, TableView1)
I honestly have no idea why it still displays the last record.