Diese Seite mit anderen teilen ...

Informationen zum Thema:
Forum:
WinDev Forum
Beiträge im Thema:
7
Erster Beitrag:
vor 4 Monaten, 4 Wochen
Letzter Beitrag:
vor 4 Monaten, 3 Wochen
Beteiligte Autoren:
Elisha Spicer, Fabrice Harari

WDM21 - Write to SQLite DB on android

Startbeitrag von Elisha Spicer am 23.01.2018 21:23

i am in the process of writing my first app with WDM21, it is a barcode scanner for our inventory and tracking. i have successfully been able to get my barcode scanner to retrieve the correct information and display it on screen.

the issue im having relates to writing information to the same (local) database.

i have a couple fields i need to put information about the scanned item.

i have attempted to use an insert query to push the information entered to a new line in one of the tables in the database. however i am not getting anything saved to it.

i have been scouring the tutorial pdf and the doc.windev.com help pages but am running into a wall.

Antworten:

Hi

1. you should use HFSQL instead of sql lite, as this will allow you to easily change the DB structure when needed (see help of hmodifystructure)

2. Just do:

hreset(File)
File.Field1=value1
File.Field2=value2
if hadd(File)=false then
info(herrorinfo(herrfulldetails))
end


This way, either it works and the problem is solved, or you have an error message you can post here

Best regards

von Fabrice Harari - am 23.01.2018 21:45
Ok, i do have a question.

we run SqlServer 2016 on our server, will we have issues importing hfsql into it?

the reason we were trying to go with sqlite, we are under the impression that it is more compatible with sqlserver to import the data?

von Elisha Spicer - am 23.01.2018 23:07
Hi Elisha,

neither is 'compatible' with MSSQL (whatever that would mean) and it's not a problem in either case as:
- you cannot read/write DIRECTLY in MSSQL from android (no driver/odbc or anything of the kind)
- you therefore HAVE TO use a webservice or replication system to read/write in any central DB (except HFSQL server, where pcsoft is providing a driver)
- by experience, you do NOT WANT to directly read/write in a central DB from a mobile, anyway, because the connection is going to be lost many times, and that is baaaad when you are trying to directly access data...

As an aside, I wrote a replication system compatible with android, iOS, and ANY Server side DB engine where PCSoft is providing a direct access module (ie where hadd/hmodify/hdelete is available), it's called WXReplication, is open source and available on my web site.

Even if you are not interested in the replicaton part, you can use its source as an example of REST type webservice...

Best regards

von Fabrice Harari - am 24.01.2018 12:02
Excellent, thank you for clearing that up for me. i will attempt to go with hfsql and the suggestions you posted, i will get back with the results!

von Elisha Spicer - am 24.01.2018 21:04
I used your suggestion, and it works!! no errors and the data is (aparently) being pushed to the hfsql database on my android device.

Thank You very much!

von Elisha Spicer - am 25.01.2018 06:56
Well, the boss tells me that using the database is a no go on the phone.

Im told i have to make it work with our remote sql server database.

von Elisha Spicer - am 27.01.2018 06:12
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.