Re: problem

Fabian Schmidt <[email protected]> Thu, 8 Mar 2007 10:08:17 +0100 (CET)
Newsgroups gmane.comp.db.mysql.java
Message-ID <Pine.GSO.4.61.0703081000470.1389@hartley.informatik.uni-leipzig.de>
Hi,

Am 06.03.07 schrieb soni avbnb:

> String dep1=d.getText();
> smnt.executequery("select e.name ,e.salary"+" "+"from Emp e"+ " " +"where e.dept=" dep1);

you did plan to write something like that:
   smnt.executequery("select e.name, e.salary from Emp e where e.dept=\""+dep1+"\"");

which should work in most cases (when you have no " in dep1).

Have a look at java.sql.PreparedStatement.


Fabian.


-- 
MySQL Java Mailing List
For list archives: http://lists.mysql.com/java
To unsubscribe:    http://lists.mysql.com/[email protected]