首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >如何在LiveCode中使用Sqlite

如何在LiveCode中使用Sqlite
EN

Stack Overflow用户
提问于 2013-07-03 14:09:02
回答 2查看 2.8K关注 0票数 2

我是Sqlite和liveCode的新手。我需要使用LiveCode和SqlLite.Can完成一些任务。任何人都可以告诉我适用于LiveCode的Sqlite版本,以及我可以从哪里下载它,因为我在web上找不到任何关于it.Thanks的足够信息

EN

回答 2

Stack Overflow用户

回答已采纳

发布于 2013-07-03 19:03:02

在LiveCode 6中执行以下操作

  • 进入菜单帮助和资源选择Example Stacks
  • 打开Examples文件夹
  • 双击SQLite Sampler.rev。stack SQLite Sampler.rev包含解释和代码snippets.
  • Adapt示例代码片段以满足您的需要。

例如,从该堆栈中提取的以下代码片段连接到数据库AppReg3.db。如果数据库尚不存在,则创建该数据库。

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

代码语言:javascript
复制
# 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

代码语言:javascript
复制
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
票数 3
EN

Stack Overflow用户

发布于 2013-07-03 14:58:40

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

票数 4
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/17440837

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档