需要语法方面的帮助以访问JSP中的数据



我需要从表中访问数据。我使用的代码是这样的:

string sql = "select * from bikesold "
           + "where model = '"+model+"'
           + "and mnth = '"+mnth+"' ";

错误如下:ORA-00904: "MNTH":无效标识符。

所有数据库连接都是正常的。我只需要确认这段代码的语法

string sql = "select * from bikesold "
           + "where model = '"+model+"'"
           + "and mnth = '"+mnth+"' ";

你漏掉了第二个字符串的双引号

首先,您的字符串是错误的。试试这个:

string sql = "select * from bikesold "
           + "where model = '"+ model +
           + "' and mnth = '"+ mnt + "'";

问:你的表实际上有一个名为"月"的列吗?

最新更新