Android Tutorial SQL tutorial

Status
Not open for further replies.

notedop

Member
Licensed User
Longtime User
As a tip if you would like to pre-fill data with Microsoft access, you can use sqlite ODBC to connect to your created sqlite database and pre-fill. Then you can transfer the database to your application for further usage.
link to the odbc dll.
http://www.ch-werner.de/sqliteodbc/
 

JForge

Member
Licensed User
Longtime User
Here's a small quirk, when i sort an SQL query by a text field, it treats something in lower case differently than everything else that is in upper case.

So when I sort a list of names ascending, the name that starts with a lower case b ends up at the very end...

any ideas?

Thanks!
-John
 

jcredk

Member
Licensed User
Longtime User
Hello,
Just a simple (stupid) question does sqllite handle "Like" in "where" clauses ?
Could you give me a sample please ?
Thanks
Jo
 

MaFu

Well-Known Member
Licensed User
Longtime User
B4X:
Dim namePart As String = "Erel"
Dim cur As Cursor = SQL.ExecQuery("SELECT * FROM yourtablenamehere WHERE yourcolumnnamehere like '%" & namePart & "%'")
 
Last edited:

luke2012

Well-Known Member
Licensed User
Longtime User
Hi Erel,
is there a size limit for the image using InsertBlob function ?
 

TEEGEE

New Member
Licensed User
Longtime User
the system does not support all character?


android.database.sqlite.SQLiteException: near "ñåìàâè¿èóóäæñîèæøññäèçó": syntax error: INSERT INTO tblUsers VALUES('2',''','ñåìàâè¿èóóäæñîèæøññäèçó','î²æè±ó')
 

merlin2049er

Well-Known Member
Licensed User
Longtime User


I'm using the Cursor1.GetString("col1") to get fields from my db table, but it's crashed when that field is empty.
 

Vincenzo Fabiano

Member
Licensed User
Longtime User
Sorry .. it is usually advisable to open the connection and leave it open, or open and close it every time you need to do the operations? Assuming that currently every few seconds my application needs to access certain data .. In my case the query "continue" to have the best performance, you should leave the connection open and close it only at the end or open and close all the time? Sorry for my bad English.
 

3394509365

Active Member
Licensed User
Longtime User
Hello everyone, when I load the program I would like to see in a listview 's list of the tables in my database.
I'm trying so but I do not know how to proceed,

B4X:
SQLDataBasePath As String Dim = File.DirDefaultExternal
Dim SQLDateBaseName = "xxx.db" As String


    Dim cur As Cursor
    Dim SQL As SQLdb
    Dim Cursor As Curs
    Dim strQuery As String
 
    strQuery = "SELECT name FROM sqlite_master WHERE type = 'table'"
sqlDB.Initialize (SQLDataBasePath, SQLDateBaseName, True)

'Up to here works

Curs = sqlDB.ExecQuery (strQuery)
ListView1.AddSingleLine (Curs)

Curs.Close

pleace
 
Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…