We wanted to get the text from the textfield to match it with our database and so we did this code but unfortunately we get a runtime error saying "FUNCTION srchTxfld.getText does not exist" String query1 = "SELECT * FROM clipdetails WHERE MATCH(clipTitle, clipAuthor, clipDate, clipNewspaper, clipSubject) AGAINST (srchTxfld.getText())"; Code (markup): ...then we tried converting the content of textfield to a string but doesn't return any result. String x = srchTxfld.getText(); String query1 = "SELECT * FROM clipdetails WHERE MATCH(clipTitle, clipAuthor, clipDate, clipNewspaper, clipSubject) AGAINST (x)"; Code (markup): Hope you could help us... Thanks!
what is srchTxfld defined as? You can find out what classes have what methods by going to http://download.oracle.com/javase/6/docs/api/ and finding the class.
JTextField inherits getText() from JTextComponent http://download.oracle.com/javase/6/docs/api/javax/swing/text/JTextComponent.html#getText() So, are you sure you have the component defined as a JTextField, rather than an Object? If it's defined as one of its superclasses, like Component or Object you have to cast it down to a JTextField to use the method.
Yes it is declared like this, JTextfield srchTxfld; Luckily, I found a solution. String query1 = "SELECT clipNo, clipTitle FROM clipdetails WHERE MATCH(clipTitle, clipAuthor, clipDate, clipNewspaper, clipSubject) AGAINST ('" + srchTxfld.getText() + "')"; Code (markup): Anyway, Thanks Cozmic for replying.