【问题标题】:Google Script work with jdbc and database mysqlGoogle Script 使用 jdbc 和数​​据库 mysql
【发布时间】:2013-03-23 16:45:40
【问题描述】:

我使用 google 脚本和我的 MySQL 数据库的 JDBC 连接器。我想使用变量运行查询,例如:

var rs = stmt.executeQuery("select*from Comuni where nomeComune=v");

如何让 JDBC 将末尾的 v 解释为变量?

【问题讨论】:

  • 参数化查询 - 通常带有“?”

标签: mysql jdbc google-apps-script


【解决方案1】:

我会使用常规的字符串连接——这只是 JavaScript。

为什么不试试以下方法:

var rs = stmt.executeQuery( "select * from Comuni where nomeComune={0}".format( value ) );

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2011-02-15
    相关资源
    最近更新 更多