Home > Database > Mysql Tutorial > jsp查询mysql,表名是变量,需要前段输入,怎么实现

jsp查询mysql,表名是变量,需要前段输入,怎么实现

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
Release: 2016-06-06 09:39:40
Original
989 people have browsed it

mysqljsp

如题。。。。写了一个下午就是因为表名是变量无法实现。。。。

<code> stmt = conn.createStatement();  String sql="select * from "+table1+"where station='"+station1+"'";    ResultSet rs = stmt.executeQuery(sql);</code>
Copy after login
<code>这样不能连接但是</code>
Copy after login
<code>    String sql="select * from "+table1;    String sql="select * from sql201307 where station='"+station1+"'";</code>
Copy after login
<code>这两条就可以。。。真是不明白</code>
Copy after login
Related labels:
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template