【问题标题】:How to use Sqlite with LiveCode如何在 LiveCode 中使用 Sqlite
【发布时间】:2013-07-03 06:09:02
【问题描述】:

我是 Sqlite 和 LiveCode 的新手。我需要使用 liveCode 和 SqlLite 完成一些任务。谁能告诉我什么是适合 LiveCode 的 Sqlite 版本以及我可以从哪里下载它,因为我找不到任何足够的东西网上有关它的信息。谢谢

【问题讨论】:

    标签: sqlite livecode


    【解决方案1】:

    LiveCode 中包含一个 sqlite 驱动程序。只需阅读 revDB 函数和命令。本教程可能会对您有所帮助:

    http://lessons.runrev.com/s/lessons/m/4071/l/30516-how-to-create-and-use-an-sqlite-database

    与 LiveCode 一起分发的当前版本是 3.7.4

    【讨论】:

    【解决方案2】:

    在 LiveCode 6 中执行以下操作

    • 进入菜单帮助
    • 选择示例堆栈和资源
    • 打开示例文件夹
    • 双击SQLite Sampler.rev。堆栈 SQLite Sampler.rev 包含解释和代码 sn-ps。
    • 根据您的需要调整示例代码 sn-ps。

    例如,从该堆栈获取的以下 sn-p 连接到数据库 AppReg3.db。如果数据库尚不存在,则创建该数据库。

    gConID 保存连接标识符,以便在以后的脚本中引用数据库。

    # Connect button script
    on mouseUp
      global gConID
      put revOpenDatabase("sqlite","AppReg3.db",,,,,,) into tConID
      if tConID is "" then 
        answer warning "Problem creating or accessing database!"
      else
        answer information "AppReg Connected! Your connection ID is: " & tConID
        put tConID into gConID
      end if
    end mouseUp
    

    下面创建一个表Users

    on mouseUp
      global gConID
      if gConID is "" then
        answer information "No Database is Connected to, please go back 1 step and connect to the Database!"
        exit mouseUp
      end if
      put "CREATE TABLE users(userID integer primary key, name text,email text,emailList boolean)" into tSQL
      put revExecuteSQL(gConID,tSQL) into tTmp
      handleRevDBerror tTmp
      if the result is not empty then 
        answer warning the result
        exit mouseUp
      end if
      answer information "Number of Tables Added: " & tTmp
     end mouseUp
    

    【讨论】:

    • 谢谢 Hanes..我应该在哪里存储我的 sqlite 数据库..当我构建项目时,数据库会自动封装在构建中。?
    • 请对此“sqlite 数据库的位置?”提出一个新问题
    猜你喜欢
    • 1970-01-01
    • 2013-05-07
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多