Databse connected successfully but there are something wrong in my procedur

hi
i am writing a small java application that use Microsoft SQL Server 2000 .the test application show that i am successful connect to the database.
But in my application when my press the query button ,the resulte cannot append on the textrea, i am double about it .Can anyone help me out of this??thanks !! the fllowing are my code:
import java.awt.*;
import java.awt.event.*;
import java.sql.*;
public class jdbc //main class
{  public static void main(String args[])
     GUI gui=new GUI();//GUI
     gui.pack(); //excute GUI
class GUI extends Frame implements ActionListener
     TextArea text;Panel panel; TextField sno;Button btn;
     GUI()//
     super("made by yaowu");
          setLayout(new BorderLayout());
     setBackground(Color.cyan);
     setVisible(true); text=new TextArea();
     btn=new Button("query");
     sno=new TextField(16);
     panel=new Panel();
     panel.add(new Label("entre the id of student(include10number)"));
panel.add(sno);panel.add(btn);
     add("North",panel);add("Center",text);
     text.setEditable(false);btn.addActionListener(this);
     addWindowListener(new WindowAdapter(){
     public void windowClosing(WindowEvent e)
          setVisible(false);
          System.exit(0);}});}
          public void actionPerformed(ActionEvent e){
          if(e.getSource()==btn)// when press
               {text.setText("rusult"+'\n');
               try{
               Liststudent();
               catch(SQLException ee){}
public void Liststudent() throws SQLException//connct with database
     String xh,xm,xb,nl,em,tl;
     try{
     Class.forName("com.microsoft.jdbc.sqlserver.SQLServerDriver").newInstance();
     catch(ClassNotFoundException e){e.printStackTrace();
System.out.println("Error Trace in getConnection() : " + e.getMessage());}
catch(java.lang.InstantiationException e)
          catch(java.lang.IllegalAccessException e)
String url="jdbc:microsoft:sqlserver://localhost:1433;DatabaseName=mydata";
String user="";
String password="";
Connection con= DriverManager.getConnection(url,user,password); //
     Statement sql=con.createStatement();//creat Statement
     ResultSet rs=sql.executeQuery("select* from xsqk"); //xsqk table
     while(rs.next()) //ptint the result
          {   xh =rs.getString("id");
               xm=rs.getString("name");
          xb=rs.getString("sex");
               nl=rs.getString("age");
em=rs.getString("E�Mail");
tl=rs.getString("tl");
          if(xh.trim().equals(sno.getText().trim()))
               text.append('\n'+"id"+" "+"name"+" "+"sex"+" "+"age"+" "+"E-Mail"+" "+"tl"+'\n');
               text.append('\n'+xh+" "+xm+" "+xb+" "+nl+" "+em+" "+tl+'\n');
}

Something is wrong but your code doesn't care: catch(SQLException ee){}What happens if there is an SQL exception? Nothing. That's probably what happened. Try this to find out: catch(SQLException ee){ee.printStackTrace();}

Similar Messages

  • Looks like deployment completed successfully, but there are errors in BDD/smsts Log

    I am new to MDT and getting ready start using the tool for deployments, but I am concerned about some errors in the log files.  The systems we have deployed appear fine, but I want to ask if I should be concerned about these errors.  We do not
    migrate and user data and are using MDT to upgrade older equipment to windows 8.  When the deployment has been completed, it reports 0 errors and 0 warnings.
    Thank you for any help!
    Here is the error that is in the smsts.log that appears multiple times Error - (__hrMethodRetVal == ((HRESULT)0L)) || (bFailIfMissing == false), HRESULT=80070002)
    Parsing task sequence to get schema version
    TSManager 1/9/2015 12:49:10 PM
    540 (0x021C)
    Task sequence version 3.00 TSManager
    1/9/2015 12:49:10 PM 540 (0x021C)
    Task sequence schema version is 3.00 TSManager
    1/9/2015 12:49:10 PM 540 (0x021C)
    Current supported schema version is 3.10 and 3.00
    TSManager 1/9/2015 12:49:10 PM
    540 (0x021C)
    Processing get action table request TSManager
    1/9/2015 12:49:10 PM 540 (0x021C)
    Got root node now getting list of all child elements
    TSManager 1/9/2015 12:49:10 PM
    540 (0x021C)
    There are 7 first level steps or groups TSManager
    1/9/2015 12:49:10 PM 540 (0x021C)
    Processing group TSManager
    1/9/2015 12:49:10 PM 540 (0x021C)
    Parsing group node: Initialization TSManager
    1/9/2015 12:49:10 PM 540 (0x021C)
    Description: Initialize the TS environment TSManager
    1/9/2015 12:49:10 PM 540 (0x021C)
    ContinueOnError: false TSManager
    1/9/2015 12:49:10 PM 540 (0x021C)
    Disable: false TSManager
    1/9/2015 12:49:10 PM 540 (0x021C)
    (__hrMethodRetVal == ((HRESULT)0L)) || (bFailIfMissing == false), HRESULT=80070002 (e:\nts_sms_fre\SMS\common\inc\ccmxml.h,566)
    TSManager 1/9/2015 12:49:10 PM
    540 (0x021C)
    another error
    DefaultVarlist found TSManager
    1/9/2015 12:49:10 PM 540 (0x021C)
    Variable name: ImageSize TSManager
    1/9/2015 12:49:10 PM 540 (0x021C)
    Variable name: ImageProcessorSpeed TSManager
    1/9/2015 12:49:10 PM 540 (0x021C)
    Variable name: ImageMemory TSManager
    1/9/2015 12:49:10 PM 540 (0x021C)
    Variable name: VerifyOS TSManager
    1/9/2015 12:49:10 PM 540 (0x021C)
    Action command line: cscript.exe "%SCRIPTROOT%\ZTIValidate.wsf"
    TSManager 1/9/2015 12:49:10 PM
    540 (0x021C)
    Adding instruction at 4 TSManager
    1/9/2015 12:49:10 PM 540 (0x021C)
    Parsing step node: Check BIOS TSManager
    1/9/2015 12:49:10 PM 540 (0x021C)
    Description: TSManager
    1/9/2015 12:49:10 PM 540 (0x021C)
    ContinueOnError: false TSManager
    1/9/2015 12:49:10 PM 540 (0x021C)
    SuccessCodeList: 0 3010 TSManager
    1/9/2015 12:49:10 PM 540 (0x021C)
    (__hrMethodRetVal == ((HRESULT)0L)) || (bFailIfMissing == false), HRESULT=80070002 (e:\nts_sms_fre\SMS\common\inc\ccmxml.h,566)
    TSManager 1/9/2015 12:49:10 PM
    540 (0x021C)

    Error 80070002 is Windows can not find the file specified. Look at your BDD.log at the time stamp SMSTS.log shows this error.  I highly doubt there is anything wrong though. Some of the stuff you see in SMSTS.log can be along the lines of hey does
    blah exist? If blah doesn't exist then do some stuff else do some other stuff.
    Please remember to click “Mark as Answer” on the post that helps you, and to click “Unmark as Answer” if a marked post does not actually answer your question. This can be beneficial to other community members reading the thread.

  • Try to queue threads of clients but there is something wrong!

    Hello. I have been trying to queue threads of clients in multithreaded server but there is a problem none of the threads is alive.
    here is my code.
    class queueClient extends Thread{
    HandleServer sa1;
    LinkedList queue = new LinkedList();
    queueClient(){
    super();
    }//end of costructor
    /**method in the queueClient class to put each client in the queue*/
    public void queuethem(HandleServer s){
    try{
    s.wait();
    queue.add(s);
    catch(InterruptedException sleep){
    System.exit(0);
    }//end of queuethem
    /**method in the queueClient class to manage the clients in the queue*/
    public void manageQueue(HandleServer sa){
    if(!queue.isEmpty() && (queue.size())==1){
    sa= (HandleServer)queue.removeFirst();
    sa.notify();
    sa.start();
    else if (!queue.isEmpty() && (queue.size()>1)){
    sa= (HandleServer)queue.removeFirst();
    sa.notify();
    sa.start();
    try {
    if(sa.currentThread().isAlive()){
    sa1= (HandleServer)queue.removeFirst();
    sa1.join();
    else{
    sa1.notify();
    sa1.start();
    catch (InterruptedException join) {
    System.exit(0);
    else{
    System.out.println("Queue is empty");
    }//end manageQueue
    }//queueClient class end

    ok lets say that i have 3 clients connected to my server which is responsible to pass the messages from only one client to a robot.
    Ok ?
    Then this server must queue the other two clients and leave only one "Alive" and the other two must wait a certain amount of time untill the current client that speaks with the server and the robot to die and then to wake up the other one client and start to talk with the server and the robot
    now is it more clear?

  • HT204266 I am trying to download Tap Tap Revenge on my new Ipad air..however..i searched for it in the App Store but there are none...help please..i really love this game! Is there something wrong with my App Store or my ipad??

    I am trying to download Tap Tap Revenge on my new Ipad air..however..i searched for it in the App Store but there are none...help please..i really love this game! Is there something wrong with my App Store or my ipad??

    It looks like the app is not currently in the App Store, I can't find it in the UK nor US stores.
    If you had previously downloaded it then do you have a copy on your computer's iTunes so that you can sync it to your iPad ?

  • My iPhone is in recovery mode, But once it's done with the process a tab comes up saying there was something wrong restoring it (1015) error. Any suggestions of how I could fix this?

    My iPhone is in recovery mode, But once it's done with the process a tab comes up saying there was something wrong restoring it (1015) error. Any suggestions of how I could fix this?

    Error 1015: This error is typically caused by attempts to downgrade the iPhone, iPad, or iPod touch's software. This can occur when you attempt to restore using an older .ipsw file. Downgrading to a previous version is not supported. To resolve this issue, attempt to restore with the latest iPhone, iPad, or iPod touch software available from Apple. This error can also occur when an unauthorized modification of the iOS has occurred and you are now trying to restore to an authorized, default state.
    In other words:
    The backup to which you're trying to restore was created with a lower or previos version of iOS than the one installed on your iPhone during the recovery.  If this is the case then you'll be unable to restore your phone with that backup and you'll have to set your iPhone up as new.  Or,
    Your iPhone was/is jailbroken.  If this is the case, there is nothing anyone here or at Apple can do for you.

  • Hi, my iphone is disabled now and it says connect to itunes but there are some problems to fix it .

    Hi, my iphone is disabled now and it says connect to itunes but there are some problems to fix it .
    Firstly, i reset my computer few days ago and never used itunes after that .
    Secondly, the power button on the iphone is broken so i can't set the recovery mode on the phone.
    I Tried connect the itunes with the iphone but the all itunes says 'To allow access , please respond on your iphone' but there's nothing i can do,
    iphone doesn't respond at all .
    I need some help .... i tried everything i could do ..

    Hey jinyoung_20,
    Based on the information you have provided, it appears your iPhone needs to be serviced. The following link should help you get started with the process and has links with additional information on topics such as warranty and service pricing, and express replacement service:
    http://support.apple.com/kb/index?page=servicefaq&geo=United_States&product=ipho ne
    Welcome to Apple Support Communities!
    Sincerely,
    Delgadoh

  • I downloaded Lion and  have attempted to 'updat' it from apps to my imac... after 3 hours of uploading it show mw an error message saying there's something wrong with my internet connection... which there is not. Anyone else experience this?

    I downloaded Lion and  have attempted to 'update' it from apps to my imac... after 3 hours of uploading it show me an error message saying there's something wrong with my internet connection... which there is not. Anyone else experience this?

    What type of Internet connection do you have?  How fast is it?

  • Eraser tool in Photoshop CS4 acts as if it is transparent when on brush or pencil mode. Block acts like its not transparent at all but there are no options for opacity, flow or brush size. Whats wrong and how to I make the brush and pencil eraser erase co

    Eraser tool in Photoshop CS4 acts as if it is transparent when on brush or pencil mode. Block acts like its not transparent at all but there are no options for opacity, flow or brush size. Whats wrong and how to I make the brush and pencil eraser erase completely without having to go over it multiple times?
    It started randomly about two weeks ago and I thought it was a glitch that would just go away. But now I am getting sick of using only the block eraser on one size. Help?

    The easiest thing to start with is to reset the Eraser Tool.
    Right click on the Eraser icon in the tool options bar and then click on Reset Tool.

  • I have turned keychain 'on' on both my ipad and iphone 5. The instructions that I have read just say follow the on screen instructions, but there are none. What am I doing wrong?

    I have turned my keychain 'on' on both my i phone 5 and my ipad. the instructions online say I should just follow the on screen instructions to set this up, but there are none. What I am doing wrong?

    Apps downloaded on one should also appear on the other as long as the app in question runs on both iPads and iPhones.

  • Safari tries repeatedly to open a page. The page partially opens but then Safari reports that there's something wrong with page and I get an error message. This is happening at too many web sites for one site to be having issues.

    Safari tries repeatedly to open a page. The page partially opens but then Safari reports that there's something wrong with page and I get an error message. This is happening at too many web sites for one site to be having issues.

    I have a similar problem, Safari cannot load a complet page. It stalls e.g. ["38 of 42"]. sometimes it will complete loading after a long wait. just as often it will never complete the page,
    The same thing happens in chrome and firefox but safari on my iPad works just fine.
    I have the latest version of everything
    I assume there is a system problem but cleaning up permissions does not help

  • I must close mu iCloud account on my iphone but can't came in. Have no password and can't get a new one, have not the emailadress any longer and there is something wrong with my securityquestions.

    i must close mu iCloud account on my iphone but can't came in. Have no password and can't get a new one, have not the emailadress any longer and there is something wrong with my securityquestions.

    Hello Malin1951,
    Thank you for contacting Apple Support Communities.
    The following article should guide you through resetting your iCloud password so that you can close it on your iPhone.
    iCloud: Account troubleshooting
    http://support.apple.com/kb/TS3988
    Regards,
    Jeff D.

  • Hi all i won't update my iPod touch 4 generation to ios 5 but there are win the download end its showing a massage (the network connection timed out)

    Hi all i won't update my iPod touch 4 generation to ios 5 but there are win the download end its showing a massage (the network connection timed out)

    Okay. I've tried syncing it first, resetting it first, downloading the firmware, uninstalling and reinstalling iTunes, I've checked my connections and ports and everything, run all kinds of diagnostics, and nothing is working. Every time it says it's backing it up, my iPod resets and then it's back to square one. I'm going to restore it and see if that helps. What a pain in the butt, especially since it wouldn't back it up.... >.<

  • Turned my iphone 4 off now I turned it on again and stuck on apple logo, after this i put it in recovery mode but it failed and itunes says there is something wrong with my iphone any ideas

    My iphone 4 stuck on the apple logo then it wont work in recovery mode. My iphone then wouldnt work in recovery mode, itunes said there is something wrong with my iphone. On my iphone it says connected to itunes any ideas what could be wrong

    You might have to get it serviced, or visit an Apple Store to get it looked at.
    Apple - Support - Service Answer Center

  • There's something wrong with my iphone 4s

    So there's something wrong with my iPhone 4s.
    Just recently it worked fine and all of a sudden it started going insane so what I did was turn my phone off for five minutes then back on. When I did my imessage won't work nor does my app called Line won't allow me to log in claiming my network is not working properly (when in fact it is because I used safari and searched five websites and it works fine) then I tried my imessage and it still won't work so I went to my settings and when I did it said my imessage was off so I switched it on and it was asking for my apple ID and I gave the correct information, making sure to type the password slowly so I won't make errors but still it claims I have the wrong password. I have other apple IDs and I used them and they all have the same password and still nothing. It's really annoying and I want it to be fixed soon because I've tried everything, I've tried putting it on airplane mode then putting it off, turning off imessage and restarting then turning it on again, I can't even log on to my apple ID here properly a few seconds ago and I restarted my phone already and shut it off too and still no difference.
    I'm hoping someone who can help me, please  nothing that requires deleting files because my files are important I do remember backing up on iCloud but I'm not quite sure when I did that and so I'm afraid of using that back up file.

    Hi Rsh Ahmed,
    Thanks for visiting Apple Support Communities.
    If you're not able to connect to wi-fi networks after updating, try the steps in our wi-fi troubleshooting article:
    iOS: Troubleshooting Wi-Fi networks and connections
    http://support.apple.com/kb/ts1398
    All the best,
    Jeremy

  • There is something wrong with the forum

    There is something wrong with the forum. it is messed up.!
    I been a little bit observant this past few days, I observed alot of problems..
    here are a few, ( there are actually alot more, but I could not describe it. its just very weird.
    I thought someone hacked to my profile and used it to ask that one, but when I clicked on it, it was just one of the questions I have responded to.
    sometimes I can not post to threads, an error would come up, most especially if I reply to a reply,
    sometimes, when I Post images it would work the first time I post it, but when I search for it again, only the links are given, no images anymore.
    sometimes I get booted out randomly, in the middle of writing a reply
    sometimes the posts switches from threaded to flat , flat to threaded, and sometimes both.
    sometimes when I checked on the stuffs>discussion, the post is highlighted but there is no new response or like, and even there was, I can see which one is it, especially to the posts that had many reply already
    sometimes it still sends email to my gmail eventhough i have unsubscribe to the post already,
    sometimes get error 504, and some other numbers I forgot.
    sometimes during writing a response the blinking thing that indicates where are you writing goes missing or on the wrong place.
    OH come on..! I am trying to help, you don't want one?
    and don't blame it on ,my browser ( i checked and used IE9, FIREFOX, and even CHROME), or to my internet connection.( i got the best there is for home connections), or to my laptop ( it's a little bit old, but it still kicks butt holes) and tried it already with other pc/internet connection/and whatnot.
    I am still sometimes visiting my previous home (NOKIA FORUM) and I don't experience those, and we even have live chat over there,
    this forum needs a revamp. and how I wish this could be repaired via Sony Update Service, or PC Companion, but of course if it was possible I would have done it already.
    We try to help users, make the forum conducive for users trying to help users. \m/
    best of luck,,
    MARLON LB :smileywink:

    This is how the forum looks for me.
    But during around midnight, (gmt +8) the forum changes to this

Maybe you are looking for