PROFESSIONAL NEWSGROUPS
WINDEV
,
WEBDEV
and
WINDEV Mobile
Home
|
Recent messages
|
Connect
|
Sign out
|
English
Home
→
WINDEV Mobile 2024
→
Use SQL statements in WinDev Mobile 21
Use SQL statements in WinDev Mobile 21
Started by JAMESGOT, Oct., 10 2022 6:35 AM - 1 reply
Connect yourself…
JAMESGOT
#1
Registered member
1 message
Posted on October, 10 2022 - 6:35 AM
I'm developing an Android app with a SQLite database in WM21 but I can't find the way to execute SQL statements like ALTER TABLE.
Query editor don't suport this kind of statements, function HExecuteSQLQuery() declares this query to the HFSQL engine and fails, and SQLExec() doesn't work because SQLConnect() isn't avaliable in Android.
Exists any way to do this with WM21?
Report
0
0
Merijn
#2
Posted on October, 10 2022 - 11:15 AM
Hi JamesGot,
ctDB
is
C
onnection
s
SQL
is string
b
Modify
is boolean
dsChange
is Data Source
b
Open
is boolean
ctDB
..
Provider
=
hNativeAccessSQLite
ctDB
..
Access
=
hOReadWrite
ctDB
..
Source
=
fDataDir
+ [
fSep
] +
"Your.db"
ctDB
..
Server
=
fDataDir
+ [
fSep
] +
"Your.db"
// user, pwd, etc
IF
HOpenConnection
(
ctDB
)
THEN
IF
HChangeConnection
(
"*"
,
ctDB
)
THEN
b
Open
=
True
ELSE
Error
(
"Fiddle database"
+
RC
+
HErrorInfo
(
)
)
END
ELSE
Error
(
"Open database"
+
RC
+
HErrorInfo
(
hErrFullDetails
)
)
END
IF
b
Open
THEN
s
SQL
=
"ALTER TABLE tablename ADD NewField FieldType"
IF
NOT
HExecuteSQLQuery
(
dsChange
,
ctDB
,
hQueryWithoutCorrection
,
s
SQL
)
THEN
Error
(
HErrorInfo
(
)
)
END
END
Hope this helps,
MerijnW
Report
0
0
→ Go back to WINDEV Mobile 2024
WINDEV 2024
WEBDEV 2024
WINDEV Mobile 2024
WINDEV (earlier versions)
Français
English
Español
Portuguesa
Close this window
Search type
Only topics
All the messages
Search period
Any time
Past hour
Past 24 hours
Past week
Past month
Past year
Cancel
Preview of your message
Adding an image
Import an image from a URL
Send an image from a file of your disk
Drop a file or click "Browse..."
or
Cancel
0%
WLanguage
SQL
XML, HTML
JAVA, Javascript
Text