473,385 Members | 1,720 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Please help with selecting a String from a database

What is wrong with my codeing. When I select the search button via my GUI, the GUI dissappears, it doesn't even go to the catch dialog. But when I copy and paste my search query to MySQL it works normally. Please explain.

Here is my code:

Expand|Select|Wrap|Line Numbers
  1. If (source == searchB)
  2. {
  3. try
  4. {
  5. query = "SELECT Telephone,Book,Date from loan WHERE Name = ' " +
  6. nameT.getText() + " ' ";
  7.  
  8. rs = stmt.executeQuery(query);
  9. rs.next();
  10. TelT.setText(rs.getString("Telephone"));
  11. bookT.setText(rs.getString("Date"));
  12. dateT.setText(rs.getString("Date"));
  13. }
  14. catch(SQL Exception sql)
  15. {
  16. JOptionPane.showMessageDialog(this,"Details not found");
  17. }
  18. }
  19.  
Thank you in advance.

Petra
Aug 14 '07 #1
4 939
pbmods
5,821 Expert 4TB
Heya, Petra.

Can you echo your query? What does it look like?
Aug 14 '07 #2
Heya, Petra.

Can you echo your query? What does it look like?
When I type in a persons name in my GUI I want it to link to my database and give me the persons telephone number, the book they loaned and the date that they took the book.

Petra
Aug 14 '07 #3
ak1dnar
1,584 Expert 1GB
When I type in a persons name in my GUI I want it to link to my database and give me the persons telephone number, the book they loaned and the date that they took the book.

Petra
As I can see from the Original post your GUI is Java Based.
So first try to get the User Inputs from the input box and try to print It back when pressing the *Search Button*.

If its working then we will try to check it out whats going on there on the try and catch blocks.
Aug 15 '07 #4
As I can see from the Original post your GUI is Java Based.
So first try to get the User Inputs from the input box and try to print It back when pressing the *Search Button*.

If its working then we will try to check it out whats going on there on the try and catch blocks.
You're correct in assuming that my GUI is Java Based. Please forgive me, but please can you explain in laymans terms what you want me to do. I'm very new at programming.

Thank you.
Aug 15 '07 #5

Sign in to post your reply or Sign up for a free account.

Similar topics

6
by: Martin Marques | last post by:
When running initdb on a fresh 7.4 install I get this error: postgres@bugs:~$ /usr/local/pgsql/bin/initdb -D /usr/local/pgsql/data -E latin1 The files belonging to this database system will be...
2
by: Ron | last post by:
How can I select a certain number of characters from a string, without selecting the whole string? For example, I want the first 50 characters of a 500 character string in my database. What...
42
by: Dooglo | last post by:
I'm new VB and programming all together, but I'm getting he hang of it. My question is; I'm writting a program to figure square feet and yards when the user inputs "Length in feet and inch (...
6
by: SandySears | last post by:
I am trying to use a stored procedure to insert a record using VS 2005, VB and SQL Server Express. The code runs without errors or exceptions, and returns the new identifer in the output...
2
by: Jobs | last post by:
Download the JAVA , .NET and SQL Server interview with answers Download the JAVA , .NET and SQL Server interview sheet and rate yourself. This will help you judge yourself are you really worth of...
8
by: Greg Lyles | last post by:
Hi all, I'm trying to develop an ASP.NET 2.0 website and am running into some real problems with what I thought would be a relatively simple thing to do. In a nutshell, I'm stuck on trying to...
5
by: Glen Buell | last post by:
Hi all, I have a major problem with my ASP.NET website and it's SQL Server 2005 Express database, and I'm wondering if anyone could help me out with it. This site is on a webhost...
2
by: rocksoft | last post by:
Hi I am working in asp.net with C# web application, I have used visual studio 2003, i have used dropdownlist in my application to populate the data from mysql database, i have got problem while...
5
by: loveshack | last post by:
Can anyone help me please (i am quite a novice, but having fun learning). Im not sure if this is an ASP problem, a javascript problem or a browser problem. Firstly, everything i have written...
1
by: shapper | last post by:
Hello, I am using the following: PostPaper paper = (from p in database.Posts where p.PostID == id select new PostPaper { Post = p, Tags = (from pt in database.PostsTags join t in...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.