Insert Web Text Field data into Sqlite DB

  1. ‹ Older
  2. 2 weeks ago

    https://i.postimg.cc/L6M3YcPB/Screenshot-2019-01-04-at-15-17-09.png

  3. Lars L

    Jan 4 Pre-Release Testers, Xojo Pro Europe (Germany, Chemnitz)

    open the db in another sqlite manager such as "Datum" or so.

    With this you can check if your changes in the xojo-sqlite-interface are commited correctly.

    The IDE-inbuilt interface for sqlite isn't alway the best choice.

  4. Ralph A

    Jan 4 Santa Monica, California

    I assume this error occurs during a Debug session. If so, is that database also in your Debug folder for that project? If so, does it have a MasterAccount table?

  5. Ralph A

    Jan 4 Santa Monica, California

    @Ralph A I assume this error occurs during a Debug session. If so, is that database also in your Debug folder for that project? If so, does it have a MasterAccount table?

    I'm actually not sure if what I said above is relevant if you have the database in the IDE itself. Not sure how that works during Debug. I only use databases that are not in the IDE.

  6. Jean-Yves P

    Jan 4 Pre-Release Testers, Xojo Pro Europe (France, Besançon)

    not sure also the primary key named "ID" is a boolean field.... will certainly not work. you must use an integer.

  7. Richard D

    Jan 4 Pre-Release Testers, Xojo Pro Europe (UK, London)

    @Jean-YvesPochez not sure also the primary key named "ID" is a boolean field.... will certainly not work. you must use an integer.

    that is true, but why say cannot find MasterAccount???

  8. Paul S

    Jan 4 Pre-Release Testers, Xojo Pro Europe (Netherlands, Den Haag)

    I see in your picture that you have added a link to the database in the IDE.
    Is the link in the IDE pointing to the same location as the location that you are using to connect to the database (DBFile)?
    If not then the database you connect to doesn't have the table that you assume it does.

    Furthermore I would advise you to use SpecialFolder to get to the documents folder.

    DBFile = SpecialFolder.Documents.Child("Wyzelink").Child("Wyzelink Xojo Projects⁩").Child("ALC.sqlite")
  9. Thank you for your advice and assistance. It is very much appreciated.

    1. I have removed the ALC DB and MasterAccount table and recreate using DB Browser for SQLite as suggested by @Lars L
    https://i.postimg.cc/Mpj6cVZf/Screenshot-2019-01-06-at-05-47-06.png

    1. I have removed the link to the DB in the IDE and amended the ID Field to type Integer as suggested by @Ralph A, @Jean-YvesPochez and @Paul S
    2. I have amended the link to the DB (ALC.DB) to use the SpecialFolder as advised by @Paul S

    Thank you

  10. Jean-Yves P

    Jan 6 Pre-Release Testers, Xojo Pro Europe (France, Besançon)

    and ... does it work now ?

  11. Unfortunately not. I am still receiving the same error message.

    no such table: MasterAccount

  12. last week

    Paul S

    Jan 6 Pre-Release Testers, Xojo Pro Europe (Netherlands, Den Haag)
    Edited last week

    Do you have an app that can open an SQLite database?
    If not get one and open the database at the location as defined in your source code.
    Than you can see if the table MasterAccount is defined/available.

    A free SQLite app is DB Browser for SQLite

    Paid options are:
    Tadpole by Dave Sisemore (well known on this forum)
    His website is currently under construction. Contact @Dave S for more info.

    SQLiteManager

    Various other free/paid options are available.

  13. Jean-Yves P

    Jan 6 Pre-Release Testers, Xojo Pro Europe (France, Besançon)

    @Craig W Unfortunately not. I am still receiving the same error message.

    no such table: MasterAccount

    can you please repost the actual code ?

  14. @Paul S
    I am using DB Browser for SQLite. Please refer
    https://i.postimg.cc/BvyJBG46/Screenshot-2019-01-06-at-13-42-29.png

    @Jean-YvesPochez
    Please refer to the code below...

    Dim DBFile as FolderItem

    DBFile = SpecialFolder.Documents.Child("Wyzelink").Child("Wyzelink Xojo Projects⁩").Child("ALC.sqlite")

    Dim DB As New SQLiteDatabase
    DB.DatabaseFile = DBFile

    If DB.Connect = True Then

    Dim CustomerRecord as New DatabaseRecord

    CustomerRecord.Column("CompanyID") = TextCompanyCode.Text
    CustomerRecord.Column("CompanyName") = TextCompanyName.Text
    CustomerRecord.Column("CompanyAddr1") = TextCompanyAddress1.Text
    CustomerRecord.Column("CompanyAddr2") = TextCompanyAddress2.Text
    CustomerRecord.Column("CompanyAddr3") = TextCompanyAddress3.Text
    CustomerRecord.Column("CompanyTown") = TextCompanyTown.Text
    CustomerRecord.Column("CompanyRegion") = TextCompanyRegion.Text
    CustomerRecord.Column("CompanyPostalCode") = TextCompanyPostalCode.Text
    CustomerRecord.Column("CompanyCountry") = TextCompanyCountry.Text
    CustomerRecord.Column("CompanyRegno") = TextCompanyRegNo.Text
    CustomerRecord.Column("CompanyContactNo") = TextCompanyContactNo.Text
    CustomerRecord.Column("CompanyEmail") = TextCompanyEmail.Text
    CustomerRecord.Column("CompanyWebsite") = TextCompanyWebsite.Text

    DB.InsertRecord("MasterAccount", CustomerRecord)
    MsgBox DB.errormessage
    DB.Commit

    Else
    MsgBox("The database couldn't be opened. Error: " + DB.ErrorMessage)
    End If

  15. Jean-Yves P

    Jan 6 Pre-Release Testers, Xojo Pro Europe (France, Besançon)

    is the 'ID' field primarykey and autoincrement ?
    else you should specify a value for the field in your code.

  16. Thank you all for your assistance.

    I managed to resolve but it is an interesting one...

    If I shorten the FolderItem path it then identifies the DB and the table

    DBFile = SpecialFolder.Documents.Child("Projects").Child("ALC.sqlite") <========== NEW PATH
    DBFile = SpecialFolder.Documents.Child("Wyzelink").Child("Wyzelink Xojo Projects⁩").Child("ALC.sqlite") <============== OLD PATH

    Your assistance is very much appreciated.

  17. Paul S

    Jan 6 Pre-Release Testers, Xojo Pro Europe (Netherlands, Den Haag)

    Of course.
    The problem was probably the fact that there were spaces in the pathname (Wyzelink Xojo Projects)
    Adding opening and closing quotes to the pathname would have solved the problem too.

    DBFile = chr(34) + SpecialFolder.Documents.Child("Wyzelink").Child("Wyzelink Xojo Projects⁩").Child("ALC.sqlite") + chr(34)
  18. I learnt something new.

    Thank you.

  19. Anthony M

    Jan 6 Pre-Release Testers, Xojo Pro

    I’m curious though, why did Xojo give a “no such table” error which makes it look like the DB file is accessible but missing the table? Why not give a “File not found” or “No database found” error?

  20. Ralph A

    Jan 6 Santa Monica, California

    @Craig W I learnt something new.

    Thank you.

    Welcome to Xojo and its community, Craig.

  21. Thank you Ralph

or Sign Up to reply!