View Single Post
  #3 (permalink)  
Old 15-03-2010, 08:40 PM
tdc5013 tdc5013 is offline
Junior Member
 

Join Date: Mar 2010
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
tdc5013 is on a distinguished road
Default Re: Pulling in data from access

I managed to fix the problem. It turned out I had the "key" in the database as an AutoNumber, but everytime I was looking for it in the program I was using a String.

My program now more or less works fine, except for one little thing. In the part of my program where I create a playlist I want a message saying "No such track" to appear in the main textfield (called "list) if the textbox where the user inputs the key (trackNumber) is empty, or has an unrecognised input; basically if it is 'null'.

if (trackNumber == null)
//If the number doesn't correspond to anything in the library...
{
list.setText("No such track number");
//Display "No such track number" in the "information" text field
}

Except when testing this instead of the message I get "null - null".

I found that the message did actually appear whenever I changed "trackNumber" to "name" in the If statement.

( String name = LibraryData.getName(key); - LibraryData is the part of the program interacting with the database )

However, this then stops other parts of the program working - such as the reset function, which merely clears "list". The message "No such track number" just stays there.

Any ideas?
Reply With Quote