How to make a Predefined function out of this

I am new into java, and I wanted to define certain sets of command into a single function to avoid redundancy and to have a much shorter code. Below is the problem,
import java.sql.*;
import java.io.*;
public class Ivatanako
static void displayResult(){
name = resultSet.getString(2);
                         idnum = resultSet.getString(3);
                         mach1 = resultSet.getString(4);
                         mach2 = resultSet.getString(5);
                         q1 = resultSet.getDouble(6);
                         q2 = resultSet.getDouble(7);
                         q3 = resultSet.getDouble(8);
                         rsf = resultSet.getDouble(10);
                         fg = resultSet.getDouble(11);
     public static void main(String args[])
               DataInputStream input=new DataInputStream(System.in);
try
               Class.forName("sun.jdbc.odbc.JdbcOdbcDriver").newInstance();
               Connection conn = DriverManager.getConnection("jdbc:odbc:;DRIVER=Microsoft Access Driver (*.mdb);DBQ=c:\\db.mdb;PWD=mypass","login","password");
               Statement command = conn.createStatement();
if (option==1){
                         System.out.println("Enter name: ");
                         stdName = input.readLine();
                         resultSet = command.executeQuery("SELECT * from Students where stud_name='" + stdName + "'");
                         while (resultSet.next( )) {
                         displayResults();
                         allRecords(name, idnum, mach1, mach2, q1, q2, q3, rsf, fg);
conn.close();
     catch (SQLException se)
               System.out.println(se);
          catch (Exception ex)
               System.out.println(ex);
}It always returns a "undeclared" error.. How to fix this? Rather how to declare a predefine function that contains ResultSet's?

static void displayResult()static void displayResult(ResulteSet resultSet)
displayResults();displayResults(resultSet);

Similar Messages

  • How to make an object getting out of the screen ?

    Hello everybody !
    I am creating a game introduction with Flash pro CS6 and here's is my problem.
    I want a object in my animation to leave the screen, but I dont know how to do it.
    Is there for example, a way to delimited the working area, so that when I make an object go out of this area, it does not appear in my final animation ( no matter the format, .avi, .mov, spritesheets ... ) or can eventualy be "cut" ( if I make my object half inside the working arear and half outside ) ?
    Is there an other way to do this ?
    Thanks !

    Using a mask might be one way.

  • How to make the zoom in/out scale appear in the media browser ?

    How to make the zoom in/out scale appear in the media browser ? My videos only appear as a file list (only the names) and the zoom in/out device is currently not in the media browser...

    I meant that there is no "Icon mode" button or "List mode" button in my media browser. How to make them appear ?

  • How to make a short clip out of the original one ?

    Some days ago, I asked a question on editing a clip in this forum. The responder asked me to provide a few seconds of the clip for his examination. But I got stuck. I didn't know how to make a clip of a few seconds out of the original clip and that it had the exact same format and properties as the original clip.
    Neither Premier nor After Effect have an ouput option such as "same as original source" .
    So, my question is how to make a short clip out of the original one with everything the same properties as the original one.
    Thanks in advance.

    May be I haven't made myself clear
    Sorry, but I think that I am still not following you.
    I want to export and render the short clip to a new file which I want to have everything the same as the original clip. Just like I cut off a few seconds off it and that few seconds becomes an independent file.
    OK, you have your original source file. It is complete and is also unaltered. If you want a "Copy" of it, just use Windows Explorer, or similar to make that Copy. If you want a separate file of your edited version of that source file (as it appears in the Timeline), use the WAB (Work Area Bar) to include just that edited instance of the source footage, and Export just the WAB. This will give you a separate file with the edits in it.
    I still feel that neither is what you want. If you can step me through, maybe with screen-caps, what you have and what you wish to end up with, I can see the operation more clearly.
    Good luck,
    Hunt

  • How to make it repleatedly printed out by using timer??

    Dear Friends:
    I have following code to run, When I press R to repeat println, only 1 line print out,
    But I hope to make it continueously print out.
    How to make it repleatedly printed out until I press CTRL + C key ??
    Thyanks
    import java.util.*;
    import java.awt.event.ActionEvent;
    import java.awt.event.ActionListener;
    import java.io.*;
    public class CertainAndRepeatTime{
      public static void main(String[] args) throws IOException{
        int delay = 1;
        Timer timer = new Timer();
        ActionListener actionListener = new ActionListener() {
            public void actionPerformed(ActionEvent actionEvent) {
              System.out.println("Hello World Timer");
        System.out.println("What do you want (Certain time or Repeat time)?");
        System.out.print("Please enter \'C\' or \'R\' for that: ");
        BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
        String ans = in.readLine();
        System.out.print("Please enter  ans=" + ans  + " IsTrue=  " + (ans.equals("R") || ans.equals("r")) +"\n");
        if (ans.equals("C") || ans.equals("c")){
          //System.out.println("This line is printed only once start...");
          timer.schedule(new TimerTask(){
            public void run(){
              System.out.println("This line is printed only once.");
          },delay,1);
        else if(ans.equals("r") || ans.equals("R")){
          timer.schedule(new TimerTask(){
            public void run(){
              System.out.println("This line is printed repeatedly.");
          },delay, 1000);
        else{
          System.out.println("Invalid Entry.");
          System.exit(0);
        System.exit(0);
    }

    The Timer is working fine, but because it runs in another Thread, your program is ending before the Timer can repeat.
    The simplest way to make your program wait until it is force-quitted as you describe would be to make an infinite loop (although this isn't very good practice), like this:
        else if(ans.equals("r") || ans.equals("R")){
          timer.schedule(new TimerTask(){
            public void run(){
              System.out.println("This line is printed repeatedly.");
          },delay, 1000);
        while(true){} //This will make your main thread hang.
        }A better way, though, would be to listen again with your System.in reader until they enter a letter that means quit.

  • How do I get a date out of this: 14:35:42.0868394-08:00  ???

    I am receiving an XML document from a person who generates it via a .Net page. This is supposed to be a date/time object.  In his .Net code he uses the object just fine.  I have asked that he translate it to something more standards like {ts '2012-03-01 15:59:45'} but he won't and said I should just figure it out... Nice, huh?
    Does anyone have any idea how I can get a date out of this value:
    14:35:42.0868394-08:00 ???
    I know that the last part (-08:00) refers to Pacific Standard Time.  I am pretty sure that the 14:35:42 represents 2:35:42  PM.  If that is correct, the 0868394 must represent 3/1/2012 (the day I ran the report).
    Please help.

    HugoSchmidt wrote:
    I am receiving an XML document from a person who generates it via a .Net page. This is supposed to be a date/time object.  In his .Net code he uses the object just fine.  I have asked that he translate it to something more standards like {ts '2012-03-01 15:59:45'} but he won't and said I should just figure it out... Nice, huh?
    Does anyone have any idea how I can get a date out of this value:
    14:35:42.0868394-08:00 ???
    I know that the last part (-08:00) refers to Pacific Standard Time.  I am pretty sure that the 14:35:42 represents 2:35:42  PM.  If that is correct, the 0868394 must represent 3/1/2012 (the day I ran the report).
    -08:00 may indeed refer to the time zone. However, if you're expecting the date-time, then he is shortchanging you. What he has sent you is just the time in hours, minutes and seconds, with the seconds expressed in 7 decimal places.
    You could just ignore the decimal places, and extract the time as follows
    <cfset datetime_string = "14:35:42.0868394-08:00">
    <cfset the_time            = listgetat(datetime_string, 1, ".")>
    <cfoutput>#the_time#</cfoutput>

  • How to make Ctrl  + N function as down key in finder

    I want to make Ctrl + N function as down key and Ctrl + P function as up key in finder application for easy keyboard navigation. How can i do this?

    You're misinterpreting the way the Keyboard shortcuts you add in preferences work.
    For you to be able to turn the key sequence into a shortcut for some action that action has to exist as a menu item in the application. That is if you want to make say Show Clipboard (one menu item without a shortcut already assigned) you would put the command Show Clipboard into the section Menu Title and ad the key sequence in the Keyboard Shortcut section.
    But as there is no menu item for down one line in Finder there is nothing to put into the Menu Title section so no way to map it.
    As it turns out for text editing OS X already recognizes ^N as down one line (in fact a lot of the Emacs key bindings are recognized out of the box) Unfortunately these only apply to editing situations.  There is no way I know of to map motion commands like you are looking to do here.
    There is the possibility of adding a keybindings dictionary to your home library folder, google for something like emacs key bindings mac mavericks
    <edit> I dont't think you'll be able to do it this way either but it is worth a look</edit>
    regards

  • HOW TO MAKE A BOOLEAN FUNCTION IN LABVIEW5.0

    I want to use a boolean funtion but it does not exist in existing functions?so how can I do it?I final aim is how to make a VALVE boolean function and how to use it?please teach me,experts! Thank you very much!

    Hi,
    what do you mean by "boolean function"?
    For boolean operations you can use
    1. Case structure. It is located in Functions->Structures
    2. Boolean functions (such as AND, OR, NOT, etc.). They are located in Functions->Boolean
    3. Comparison functions (such as equal?, greater?, less?, etc.). They are located in Functions->Comparison
    You have to give more info about your problem.
    Good luck.
    Oleg Chutko.

  • How to make the wdDoIniiit() function executived twice in the view of WebDy

    Hi Guyes, How can i make the  wdDoIniiit() function executived twice in the view of WebDynpro? Thank you

    Hi
    WdDoInit() :- This is called only once when the View is loaded freshly.
    WdDoModifyView:- Called every time an action is performed on the View.
    It is called by webdynnpro runtime environment for modification of the view layout.
    For all the views,this takes place at a time immediately before the closing response renders.
    check for
    <a href="http://help.sap.com/saphelp_nw04/helpdata/en/86/16e13d82fcfb34e10000000a114084/frameset.htm">Modifyview</a>
    also you can know about <a href="http://help.sap.com/saphelp_nw04/helpdata/en/86/7fcf3d4f902d10e10000000a114084/frameset.htm">Supply function</a>
    Regards
    Abhijith YS

  • How to make selection parameter gray out, not changeble mode

    Hi Experts,
      Selection screen having parameters, I am putting default values in that parametrs.
    How to make this parameter gray out, not changeable mode.
    Thanks in advance
    mahahe.
    See comments below
    Edited by: Rob Burbank on Jul 1, 2009 12:43 PM

    Hi,
    For the parameters required, while declaring them use the MODIF ID, lets say you have choosen the modif id as SC1.
    i.e. parametes: p_mat type matnr DEFAULT '100' MODIF ID SC1.
    Then in the initialization event, code as below.
        LOOP AT SCREEN.
          IF screen-group1 = 'SC1'.
            screen-input = '0'.
            MODIFY SCREEN.
          ENDIF.
        ENDLOOP.
    It will work.
    Regards,
    Nangunoori.

  • How to make line-in come out rear speakers? (SB Live! 5

    Card is SB Li've! 5. DE and OS is XP SP2:
    ================================
    I have tried everything that I can think of. It was working fine until I installed a program which screwed up my mixer settings. I have loaded the default mixer settings. Now my rear speakers only work for wave devices, but not line-in.
    Is there a way to make line-in come out both the front and rear speakers, or set the rear speakers to duplicate the front speakers (losing the surround feature)?
    Failing that I will have to resort to plugging both sets of speakers into the one socket via an adapter - I don't wish to do this as I had this working for many months.
    Please help.
    grol
    Message Edited by groslchie on <SPAN class=date_text>-2-2005 <SPAN class=time_text>07:22 AM
    Message Edited by groslchie on -2-2005 07:23 AM

    Weird. I just installed Creative PlayCenter from the driver CD and after the reboot, line-in now comes out the rear speakers again. Must've been some system files updated or something, because CMSS is still off according to PlayCenter. When I turn CMSS on, the line-in stops coming out rear, but turning it off makes it work!!!! So it's sorted, but still have no idea why it screwed up and why I needed PlayCenter installed to change the CMSS settings.

  • How to make Text filed Grayed out / disabled

    Hi,
    I have a text field and I have set the following property..
    HTML Form Element Attributes:- readOnly=trueThis field is read only now.
    HOW to make this field looks like a disabled field, some thing like filling the background with light gray color.
    Thanks,
    Deepak

    Thanks Andy..it worked..but one clarification.
    when I am using the following code as suggested by you, I am getting the text box border, as well as gray color in the box...THIS is perfectly fine which I wanted.... (This will make that field always read only)
    Element Type - Text
    HTML Form Element Attributes - readOnly=true style="background-color:gray"NOW I want my field to be read only based on condition.
    So I am using the following code, This is displaying the gray color, but the border of the text box is gone, so it doesn't look good. How can I keep the border too..
    Element Type - Text
    Read Only Condition Type (condition - Expression1=Expression2)
    Read Only Element Table Cell(s) Attributes - style="background-color:gray"Also, How to make FONT bold, I am using - font-weight: bold; - but it's not working.
    and finally , can I define this style in custom.css file and then how to call that stylesheet here...????
    Thanks,
    Deepak
    Edited by: Deepak_J on Oct 8, 2009 11:28 AM

  • How to make customize Replace function with Positions not pattern ?

    Hi
    Due to Repalce with patterns in  flex, i am facing issue.
    I  want to make cutomize replace function with  parameters
    1 Parameter - String to replace
    2 Parameter - Start Posion.
    3 Parameter - Last position
      which return string value.
    For Example
      replaceInWholeString(str:String, sPos:Number, lPos:Number ):String
    values like
    1st paramter - "asked"
    2nd Paramter - 11
    3rd Paramter -  15
    Original String :: I want to reply
    Output string : I want to asked
    Please Reply ,if someone having solution
    Thanks
    Sunil Rana

    You can use any number of the String methods to acomplish this.
    I would proabably go with something like: slice(...) + input + substr(...);

  • How to make the scrollbar function with mouse scroll wheel?

    Is there a way how to make my content scroll even with the mouse scroll wheel?... I have to edit the coding??

    Hey!
    You shouldn't have to edit any code.
    There is an active player bug surrounding this issue however, which causes the following:
    1) It should work on windows.
    2) It may not work on Mac.
    We're continuing to pursue this issue, we know it's important to our users.
    Thanks,
    Tara

  • How to make a fully functioning form in Acrobat 8

    I am trying to make a form in Acrobat 8 and when i send it to a PC to be tested, they get an error.It says"This operation is not permitted" when they click the submit button. ANy idea how i csn fix this? it works fine on my laptop.
    Please help!

    It sounds like you're trying to submit the entire PDF using Reader. For this to work, the document has to be Reader-enabled. Acrobat 8 Pro can do this by selecting: Advanced > Enable Usage Rights in Adobe Reader.
    Some newer versions of Reader may have a problem with a form enabled in Acrobat 8, so you'll have to test it out.

Maybe you are looking for