Programming Forums
User Name Password Register
 

RSS Feed
FORUM INDEX | TODAY'S POSTS | UNANSWERED THREADS | ADVANCED SEARCH

Reply
 
Thread Tools Display Modes
Old May 4th, 2005, 9:02 AM   #1
Vengeance
Newbie
 
Join Date: Apr 2005
Posts: 8
Rep Power: 0 Vengeance is on a distinguished road
Java Combo Boxes

    public void purchaseTickets() {

        try {

            String ftime[] = new String[3];
            String fdate[] = new String[3];

            store.setFileName("FilmDatabase.jds");
            store.setUserName("odeon");
            store.setPassword("1234");
            table.setStoreName("FILMTABLE");
            table.setStore(store);
            table.open();

            table.setSort(new SortDescriptor(new String[] {"FILMID"}));
            table.first();

            while ( table.inBounds() ) {

                table.getInt("FILMID");

                int dCount, tCount;

                String filmName = (String)fNameComboBox.getSelectedItem();

                if (filmName.equals(table.getString( "FILMNAME" ) ) ) {

                    ftime[0] = table.getString( "FILMTIME" );
                    ftime[1] = table.getString( "FILMTIME2" );
                    ftime[2] = table.getString( "FILMTIME3" );

                    fdate[0]= table.getString( "FILMDATE" );
                    fdate[1]= table.getString( "FILMDATE2" );
                    fdate[2]= table.getString( "FILMDATE3" );

                    for( dCount = 0; dCount < ftime.length; dCount++ )
                        fDatesComboBox.addItem( ftime[dCount] );

                    for( tCount = 0; tCount < fdate.length; tCount++ )
                        fTimesComboBox.addItem( fdate[tCount] );

                }

                table.next();
            }

        } catch (DataSetException dse) {
            dse.printStackTrace();
        } finally {
            try {
                store.close();
                table.close();
            } catch (DataSetException dse) {
                dse.printStackTrace();
            }
        }

    }

This is the code for my project. Right, I have loaded in the movie titles and I want it so when the user picks a name from the combo box, the times and dates will change.

So what the program should do is check to see if the selected item in the combo box exists in the database. If so, then change the dates/times to that row in the table. Whenever I run this particular piece of the program it says "FilmDatabase.jds is not open". Can anyone tell me what I've done wrong please.
Vengeance is offline   Reply With Quote
Reply

Bookmarks

« Previous Thread in Forum | Next Thread in Forum »

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump




DaniWeb IT Discussion Community
All times are GMT -5. The time now is 12:09 PM.

Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC