Click here to Skip to main content
15,892,809 members
Home / Discussions / Java
   

Java

 
GeneralRe: Comparing values in the table with the value the user keyed in Pin
Arman S.7-Jan-11 6:54
Arman S.7-Jan-11 6:54 
GeneralRe: Comparing values in the table with the value the user keyed in Pin
Richard MacCutchan7-Jan-11 8:26
mveRichard MacCutchan7-Jan-11 8:26 
GeneralRe: Comparing values in the table with the value the user keyed in Pin
Arman S.7-Jan-11 8:35
Arman S.7-Jan-11 8:35 
GeneralRe: Comparing values in the table with the value the user keyed in Pin
Richard MacCutchan7-Jan-11 8:58
mveRichard MacCutchan7-Jan-11 8:58 
GeneralRe: Comparing values in the table with the value the user keyed in Pin
Arman S.7-Jan-11 9:23
Arman S.7-Jan-11 9:23 
GeneralRe: Comparing values in the table with the value the user keyed in Pin
jschell8-Jan-11 8:59
jschell8-Jan-11 8:59 
GeneralRe: Comparing values in the table with the value the user keyed in Pin
Richard MacCutchan8-Jan-11 21:49
mveRichard MacCutchan8-Jan-11 21:49 
GeneralRe: Comparing values in the table with the value the user keyed in [modified] Pin
pancakeleh9-Jan-11 16:59
pancakeleh9-Jan-11 16:59 
i have change my code slightly.

Code as shown below:

String dbURL = "jdbc:derby:....";

String myString = (String) getIncidentidtxt().getValue();
Integer incidentIDName = Integer.parseInt(myString);
  String incidentNameName = (String)getIncidentnametxt().getValue();

  try{

      Class.forName("org.apache.derby.jdbc.ClientDriver").newInstance();

      Connection con = DriverManager.getConnection(dbURL);

      Statement stmt = con.createStatement();

      ResultSet rs = stmt.executeQuery("SELECT INCIDENTID FROM INCIDENTDATA");

      //Create New Array
      ArrayList allResults = new ArrayList();

      while (rs.next()) {
          int instanceID = rs.getInt("INCIDENTID");
          allResults.add(instanceID);
          // size of the array
          int arrayCount = allResults.size();
          label3.setValue(arrayCount);

          for(Integer i =0; i<allResults.size(); i++)
          {
          if(myString.equals(allResults.get(i))){

          }
       }

              }
        }

  catch (Exception ex) {
                log("ErrorDescription", ex);
            error(ex.getMessage());
  }


But i have no idea if i did this correctly. what shld i do now to proceed on?
the main purpose of this is to compare the values in the textboxes with the database (displayed on a table).

btw i am using betneans..

http://img263.imageshack.us/img263/3673/arraysofvalues.png[^]
the image u see above is the array that i have created to store the incidentID values. how do i bases on this array to validation entry to the database? Like example the database alrdy have the id 3 when user enter 3 into the id textbox, an error message will appears?

modified on Monday, January 10, 2011 3:39 AM

GeneralRe: Comparing values in the table with the value the user keyed in Pin
Richard MacCutchan9-Jan-11 23:00
mveRichard MacCutchan9-Jan-11 23:00 
GeneralRe: Comparing values in the table with the value the user keyed in Pin
pancakeleh10-Jan-11 19:43
pancakeleh10-Jan-11 19:43 
GeneralRe: Comparing values in the table with the value the user keyed in Pin
Richard MacCutchan10-Jan-11 23:21
mveRichard MacCutchan10-Jan-11 23:21 
GeneralRe: Comparing values in the table with the value the user keyed in Pin
pancakeleh12-Jan-11 21:48
pancakeleh12-Jan-11 21:48 
GeneralRe: Comparing values in the table with the value the user keyed in Pin
Richard MacCutchan12-Jan-11 22:06
mveRichard MacCutchan12-Jan-11 22:06 
QuestionNeed urgent help in assignment of JAVA, any idea suggestion plz Pin
aesthetic.crazy5-Jan-11 12:13
aesthetic.crazy5-Jan-11 12:13 
AnswerRe: Need urgent help in assignment of JAVA, any idea suggestion plz Pin
Richard MacCutchan5-Jan-11 21:41
mveRichard MacCutchan5-Jan-11 21:41 
AnswerRe: Need urgent help in assignment of JAVA, any idea suggestion plz Pin
David Skelly5-Jan-11 22:19
David Skelly5-Jan-11 22:19 
GeneralRe: Need urgent help in assignment of JAVA, any idea suggestion plz Pin
aesthetic.crazy5-Jan-11 23:52
aesthetic.crazy5-Jan-11 23:52 
GeneralRe: Need urgent help in assignment of JAVA, any idea suggestion plz Pin
David Skelly6-Jan-11 3:26
David Skelly6-Jan-11 3:26 
GeneralRe: Need urgent help in assignment of JAVA, any idea suggestion plz Pin
aesthetic.crazy6-Jan-11 10:38
aesthetic.crazy6-Jan-11 10:38 
AnswerRe: Need urgent help in assignment of JAVA, any idea suggestion plz Pin
jschell6-Jan-11 9:25
jschell6-Jan-11 9:25 
GeneralRe: Need urgent help in assignment of JAVA, any idea suggestion plz Pin
aesthetic.crazy6-Jan-11 10:39
aesthetic.crazy6-Jan-11 10:39 
GeneralRe: Need urgent help in assignment of JAVA, any idea suggestion plz Pin
jschell7-Jan-11 13:49
jschell7-Jan-11 13:49 
QuestionCreating an ArrayBinaryTree Pin
nee-kow5-Jan-11 6:48
nee-kow5-Jan-11 6:48 
AnswerRe: Creating an ArrayBinaryTree Pin
David Skelly5-Jan-11 22:16
David Skelly5-Jan-11 22:16 
GeneralRe: Creating an ArrayBinaryTree Pin
nee-kow5-Jan-11 22:44
nee-kow5-Jan-11 22:44 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.