public void SearchTests(int Method, String key)
    {
        ReturnedTests = new ArrayList();
        
        if (key.equals(""))
        {
            tbxError.setText("Empty key words.");
            String[] temp = new String[1];
            temp[0]="";
            String[][] row=new String[1][4];
            String[] column={"Test ID","Patient ID","Doctor ID", "Test Date"};
            tblTests.removeAll();
            DefaultTableModel tmd=new DefaultTableModel(row,column);
            tblTests.setModel(tmd);
            return;
        }
        int id = -1;
        try
        {
            id = Integer.parseInt(key);
        }
        catch(Exception e)
        {
            id = -1;
        }
        Test_Controller TC = new Test_Controller("localhost", DBName, DBAccount, DBPwd);
        switch(Method)
        {
            case 0:
                if(id<=0)
                {
                    tbxError.setText("Please input a positive ID number.");
                    return;
                }
                ReturnedTests = TC.SearchTest(id, "Test");
                break;
            case 1:
                ReturnedTests = TC.SearchTest(id, "Patient");
                break;
            default:
                ReturnedTests = TC.SearchTest(key);
                break;
        }
        if (ReturnedTests.size()<=0)
        {
            tbxError.setText("No tests found");
            String[] temp = new String[1];
            temp[0]="";
            String[][] row=new String[1][4];
            String[] column={"Test ID","Patient ID","Doctor ID", "Test Date"};
            tblTests.removeAll();
            DefaultTableModel tmd=new DefaultTableModel(row,column);
            tblTests.setModel(tmd);
        }
        else
            tbxError.setText(String.valueOf(ReturnedTests.size())+" test(s) returned.");
        ShowTests();
    }