【问题标题】:how to use scope_identity in sqlite如何在 sqlite 中使用 scope_identity
【发布时间】:2011-04-30 13:04:00
【问题描述】:

当我在 sqlite 中使用 scop_identity 时遇到问题,它显示“select”附近的错误:语法错误...我这样写查询

   string txtSQLQuery = "insert into  SerpTrak_Site (SiteName) values ('" + txturl.Text +   "')select scope_identity();";

此查询中的任何错误请帮助我...

【问题讨论】:

    标签: sqlite


    【解决方案1】:

    SQLite 没有名为 scope_identity 的函数

    您可能正在寻找“SELECT last_insert_rowid()”

    另请参阅此问题:Does SQLite support SCOPE_IDENTITY?

    【讨论】:

      【解决方案2】:

      两个查询之间缺少分号。

      string txtSQLQuery = "insert into  SerpTrak_Site (SiteName) 
       values ('" + txturl.Text +   "'); select scope_identity();";
      

      【讨论】:

      • 您好,感谢您的回复..什么是正确的格式,我也尝试过不使用分号但显示错误,请帮助我....
      • -1 因为 SCOPE_IDENTITY() 不适用于 SQLite 数据库。
      • -1 因为我认为 sqlite 中没有 SCOPE_IDENTITY(),但现在我不确定。
      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2010-11-15
      • 1970-01-01
      • 1970-01-01
      • 2016-01-13
      • 2013-05-26
      • 2014-11-22
      相关资源
      最近更新 更多