Insert Web Text Field data into Sqlite DB

  1. ‹ Older
  2. 3 months ago

    Jean-Yves P

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

    and ... does it work now ?

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

    no such table: MasterAccount

  4. Paul S

    Jan 6 Pre-Release Testers, Xojo Pro Europe (Netherlands, Den Haag)
    Edited 3 months ago

    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.

  5. 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 ?

  6. @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

  7. 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.

  8. 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.

  9. 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)
  10. I learnt something new.

    Thank you.

  11. 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?

  12. Ralph A

    Jan 6 Santa Monica, California

    @Craig W I learnt something new.

    Thank you.

    Welcome to Xojo and its community, Craig.

  13. Thank you Ralph

or Sign Up to reply!