Diese Seite mit anderen teilen ...

Informationen zum Thema:
WinDev Forum
Beiträge im Thema:
Erster Beitrag:
vor 5 Jahren
Beteiligte Autoren:

[WM18] android access sqlite ?

Startbeitrag von ccc2 am 23.06.2013 07:24

Hi ,

I create a sqlite db with some records . then using WM18 I create a android app .

i create a query object Q_validate

from vw_users
users.uid= {param_uid}
and users.pwd = {param_pwd}

when I run query test from WM18 , I get error vw_users is not a table . vw_users is a view which I had imported into analysis (become a table) . from analysis , I can retrieved vw_users records via wmap without any error.

I create a window with a button and code in button

Q_Validate.param_uid = EDT_UID..Value
Q_Validate.param_pwd = EDT_PWD..Value
IF HExecuteQuery(Q_Validate) = False THEN
Error("Error Execute Q_Validate ", HErrorInfo())

IF HNbRec(Q_Validate) = 0 THEN
Warning("Invalid ID and Password")

when I try run the program on android device , I get no error for execute the query but my HNbRec(Q_Validate) always return zero even though should be 1

using android terminal emulator I try access the sqlite db from

the db file is there and the records is also there.

don't know what to do , I try the code from example InitializeDatabasec procedure in project code

PROCEDURE InitializeDatabase()

cntConnection is Connection
sDatabaseName is string = “pks.db”
sBasePath is string = fDataDir() + [“/”] + sDatabaseName
nCurrentDBVersion is int = 1
//nDBVersionInstalled is int
bFirstStartup is boolean

// Extract the database if necessary
IF NOT fFileExist(sBasePath) THEN
bFirstStartup = True
IF NOT fExtractResource(sDatabaseName,sBasePath) THEN
EndProgram("Error while extracting from the database.")

// Parameters of the connection
cntConnection..Provider = hNativeAccessSQLite
cntConnection..Source = sBasePath

// Establish the connection

with this solve the problem and the program HNbRec(Q_Validate) return 1 .
not only that now from WM18 , I can run query and not getting error anymore.

I had tried create a program using HF , it work without need any initializedatabase code .

can someone explain ? do i have to use initializedatabase code in order to access sqlite ? or had I done something wrong in setting?


Zur Information:
MySnip.de hat keinen Einfluss auf die Inhalte der Beiträge. Bitte kontaktieren Sie den Administrator des Forums bei Problemen oder Löschforderungen über die Kontaktseite.
Falls die Kontaktaufnahme mit dem Administrator des Forums fehlschlägt, kontaktieren Sie uns bitte über die in unserem Impressum angegebenen Daten.