I have a little problem with My tables in SQLite database. Well, I have a one SQLite database with lot of table names. Example 20_2013, 21_2013, 22_2013 etc. I want to load all these tables in ListView but without this sign "_" example 20 2013 not 20_2013. I create this function to load all tables from SQLite database, but i dont know how to replace "_" only in ListView, not in SQLite database because it must be with "_" in SQLdatabase. I use DBUtils.
DBUtils.ExecuteListView(database, "SELECT name FROM sqlite_master WHERE type = 'table'", Null, 0, db_table, False)
You can use a string var, e.g.
Dim day as string
day = DBUtils.ExecuteListView(database, "SELECT name FROM sqlite_master WHERE type = 'table'", Null, 0, db_table, False)
day = day.Replace("_", " ")
You can use a string var, e.g.
Dim day as string
day = DBUtils.ExecuteListView(database, "SELECT name FROM sqlite_master WHERE type = 'table'", Null, 0, db_table, False)
day = day.Replace("_", " ")
Try it directly with SQLite - something like (untested code):
B4X:
Dim cur As Cursor
Dim sqlDB As SQL
Dim day As String
Dim strQuery As String
'ListView1 is from layout
strQuery = "SELECT name FROM sqlite_master WHERE type = 'table'"
sqlDB.BeginTransaction
Try
cur = sqlDB.ExecQuery(strQuery)
For i = 0 To cur.RowCount - 1
cur.Position = i
day = cur.GetString("day")
day = day.Replace("_", " ")
ListView1.AddSingleLine2(day, day)
Next
sqlDB.TransactionSuccessful
Catch
Msgbox(LastException.Message, "Fill ListView Error")
End Try
sqlDB.EndTransaction
Try it directly with SQLite - something like (untested code):
B4X:
Dim cur As Cursor
Dim sqlDB As SQL
Dim day As String
Dim strQuery As String
'ListView1 is from layout
strQuery = "SELECT name FROM sqlite_master WHERE type = 'table'"
sqlDB.BeginTransaction
Try
cur = sqlDB.ExecQuery(strQuery)
For i = 0 To cur.RowCount - 1
cur.Position = i
day = cur.GetString("day")
day = day.Replace("_", " ")
ListView1.AddSingleLine2(day, day)
Next
sqlDB.TransactionSuccessful
Catch
Msgbox(LastException.Message, "Fill ListView Error")
End Try
sqlDB.EndTransaction
Try it directly with SQLite - something like (untested code):
B4X:
Dim cur As Cursor
Dim sqlDB As SQL
Dim day As String
Dim strQuery As String
'ListView1 is from layout
strQuery = "SELECT name FROM sqlite_master WHERE type = 'table'"
sqlDB.BeginTransaction
Try
cur = sqlDB.ExecQuery(strQuery)
For i = 0 To cur.RowCount - 1
cur.Position = i
day = cur.GetString("day")
day = day.Replace("_", " ")
ListView1.AddSingleLine2(day, day)
Next
sqlDB.TransactionSuccessful
Catch
Msgbox(LastException.Message, "Fill ListView Error")
End Try
sqlDB.EndTransaction