Could someone please check my code

I really do not know whether this code is booking the appointment or not!
The table in the database is apptNo INTEGER PRIMARY KEY NOT NULL AUTO_INCREMENT, doctorNo INTEGER NOT NULL, time INTEGER NOT NULL, date DATE NOT NULL, patient_userID INTEGER NOT NULL,
dateBooked TIMESTAMP NOT NULL);
Is this completely wrong, its supposed to check the date and time entered in the form, and if they equal a date and time already stored in the database then it should return false, however i am unaware of how to write this code so u can check against different doctor's availabilities.
Does this mean i need an availability table?
BOOKAPPT.JSP
<%@ page language="java"
import="java.sql.*, java.io.*, java.util.*, connection.*"
errorPage="error.jsp" %>
<jsp:useBean id="myconn" class="connection.cmhconn"/>
<html>
<head>
<title>Appointment Booked</title>
</head>
<body>
<% if(date == "date")&&(time == "time")
return false;
%>
<p><b><font size="4">Unable to book Appointment please choose another, date and time!</font></b></p>
<%
}else
     myconn.connect();
     String date = request.getParameter("apptdate");
     int time = Integer.parseInt(request.getParameter("appttime"));
     myconn.BookAppt(date, time);
     myconn.disconnect();
     myconn.connect();
     int doctorNo = Integer.parseInt(request.getParameter("doctorNo"));
     String dateBooked = request.getParameter("date");
myconn.addAppointment(doctorNo, dateBooked);
myconn.disconnect();
%>
Your Appointment has been booked!
<%
%>
</body>
</html>
The bean methods are here:
public ResultSet viewAppointment() throws SQLException, Exception
     ResultSet result = null;
     try
          String queryString = ("SELECT * FROM appointment;");
          Statement statement = con.createStatement();
          result =statement.executeQuery(queryString);
     catch (SQLException sqle)
          error = "SQLException: Could not execute query.";
          throw new SQLException(error);
     catch (Exception e)
          error = "Exception: An Exception occured while retrieving user data.";
          throw new Exception(error);
     return result;
public void addAppointment(int apptNo, int doctorNo, int time, String date, int patient_userID, String dateBooked)
                                   throws SQLException, Exception
     if (con != null)
     try
          PreparedStatement updateAppointment;
          updateAppointment = con.prepareStatement("insert into appointment values('', ?, ?, ?, ?, ?);");
          updateAppointment.setInt(1, apptNo);
          updateAppointment.setInt(2, doctorNo);
          updateAppointment.setInt(3, time);
          updateAppointment.setString(4, date);
          updateAppointment.setString(5, dateBooked);
          updateAppointment.setInt(6, patient_userID);
          updateAppointment.execute();
     catch (SQLException sqle)
          error = "SQLException: Update failed, possible duplicate entry";
          throw new SQLException(error);
}else
     error = "Exception: Connection to databse was lost!";
     throw new Exception(error);
public ResultSet viewBookAppt() throws SQLException, Exception
     ResultSet result = null;
     try
          String queryString = ("SELECT date, time FROM appointment;");
          Statement statement = con.createStatement();
          result =statement.executeQuery(queryString);
     catch (SQLException sqle)
          error = "SQLException: Could not execute query.";
          throw new SQLException(error);
     catch (Exception e)
          error = "Exception: An Exception occured while retrieving user data.";
          throw new Exception(error);
     return result;
Thanks in advanced

they are declared in the bean,
public ResultSet viewBookAppt() throws SQLException, Exception
     ResultSet result = null;
     try
          String queryString = ("SELECT date, time FROM appointment;");
          Statement statement = con.createStatement();
          result =statement.executeQuery(queryString);
     catch (SQLException sqle)
          error = "SQLException: Could not execute query.";
          throw new SQLException(error);
     catch (Exception e)
          error = "Exception: An Exception occured while retrieving user data.";
          throw new Exception(error);
     return result;
If this is wrong please tell me how to fix the erro
Thanks again

Similar Messages

  • Could someone please check this for

    Hi there!
    I need someone to do this quick check, so I don't have to install Vista in vain.
    I mainly use MIDI interface for compositions and playback. So, could anyone please find a MIDI file with some FASTER parts, play it, and check if there are any dropouts or note misplacements?
    It was the issue in all previous driver versions, so please, somebody check this for me will ya?
    I have X-Fi Extreme Music.
    Thanks

    Here is the link to 2 faster midi files... If you have Windows Vista, X-fi and new drivers, please listen to them and tell me do they sound good or bad. Are there any dropouts, or any other issues?
    http://www.box.net/shared/2vxsohpagv
    Thanks.

  • Could you please check this code

    Hi There,
    The scenario here is :
    I have written this piece of code but its not showing desired result .I think the problem is in the AVGRANGE.
    Please look into this and let me know if I am doing anything wrong.
    I need to accomplish this task ,if employee E1 & E2 are in Entity1 in Grade S in forecast1 and now in forecast 2 a new employee namely E3 has come in this new forecast and whether he belongs to same entity can be identified by a new account say "F",If "F" is present for that Employee in that particular entity means he belongs to that Entity .Then I need to calculate.
    "P" value for E3 for a month=Avg of "P" value for E1 & E2 in Entity1 in Grade S for that month.
    I think this code is calculating for invalid combination also.
    FIX (&CurrFctScenario,&CurrFctVersion,&CurrYear)
    FIX (&SeedCurrency)
    FIX(@descendatns("Entity"),@descendatns(GRADE),@Descendants(Employee)
    FIX (&CurrMonth:"MAY"
    , &SeedHSP
    "P"(
    IF ( "F"!=#Missing AND "P"==#Missing)
    @AVGRANGE(SKIPNONE,"P",@children(Employee)->@currmbr(Grade)->@currmbr(entity));
    ENDIF;
    ENDFIX
    ENDFIX
    One more thing as I am testing this code for say two three employees then its working fine but as I am uisng @children(Employee) then I am getting error message
    Error: 1012704 Dynamic Calc processor cannot lock more than [200] ESM blocks during the calculation, please increase CalcLockBlock setting and then retry(a small data cache setting could also cause this problem, please check the data cache size setting).
    Is there any other way of doing this calculation?
    Edited by: user10760185 on Jun 1, 2011 5:35 AM

    Thanks a lot Alp...
    Please find the logic of the calculation below:
    In forecast1,here E1=employee,S1=Grade,P1=Account member
    E1->S1->Entity1->P1= 100
    E2->S1->Entity1->P1=200
    In forecast2,E3,a new employee has come and if he/she belongs to S1 and Entity1 ,then the value should be
    If (E3->F!->@currmbr(grade)->@currmbr(entity)=#Missing AND P1==#Missing)
    E3->S1->Entity1->P1= (100+200)/2
    I will read the document and will check my cache settings.
    Edited by: user10760185 on Jun 1, 2011 11:36 PM

  • Will someone please check my code....

    Thank you to whomever decides to help me. I just want my code checked. i tested and ran it with no problems. My assignemnt is as follows:
    ***Write a method titled GCD that accepts two integers (as input parameters to the method), and returns the greatest common divisor of the two integers. Incorporate the method into an applet that obtains two integers from the user using TextFields. Display the result of GCD in the status bar and on the applet window.
    An aside it makes good sense to call the gcd method at the point you are preparing your output message. You should not call GCD from your actionPerformed method.
    heres my project
    import java.applet.Applet;
    import java.awt.*;
    import java.awt.event.*;
    public class GCD extends Applet implements ActionListener
         Label prompt1;
         TextField input1;
         Label prompt2;
         TextField input2;
         int     valx;
         int     valy;
         int     result;
         public void init()
             prompt1 = new Label( "Enter an Integer:" );
             add (prompt1);
             input1 = new TextField ( 30 );
             add (input1);
             prompt2 = new Label ( "Enter another Integer:" );
             add ( prompt2 );
             input2 = new TextField ( 30 );
             input2.addActionListener (this);
             add ( input2 );
         public void paint ( Graphics g)
             g.drawString( "The Greatest Common Divisor is:" + result, 30, 90);
             showStatus ("The Greatest Common Divisor:" + result);
         public void actionPerformed ( ActionEvent e)
             showStatus("");
             valx = Integer.parseInt( input1.getText() );
             valy = Integer.parseInt( input2.getText() );
             result = gcd ( valx, valy );
             repaint();
         int gcd ( int xvalue, int yvalue)
             if ( yvalue == 0 )
                  return xvalue;
             else
                  return gcd ( yvalue, ( xvalue % yvalue ) );
    keeping fingers crossed :)

    heres the code with what karl added... What do you think? :) It is running really good and nothing is being called in actionPerform anymore.
    import java.applet.Applet;
    import java.awt.*;
    import java.awt.event.*;
    public class GCD extends Applet implements ActionListener
         Label prompt1;
         TextField input1;
         Label prompt2;
         TextField input2;
         int     valx;
         int     valy;
         int     result;
         int     counter = 0;
         boolean drawResults = false;
         public void init()
             prompt1 = new Label( "Enter an Integer:" );
             add (prompt1);
             input1 = new TextField ( 30 );
             add (input1);
             prompt2 = new Label ( "Enter another Integer:" );
             add ( prompt2 );
             input2 = new TextField ( 30 );
             input2.addActionListener (this);
             add ( input2 );
         public void paint ( Graphics g)
             if (drawResults)
               valx = Integer.parseInt( input1.getText());
               valy = Integer.parseInt( input2.getText());
               result = gcd (valx, valy );
               drawResults = false;
               g.drawString( "The Greatest Common Divisor is:" + result, 30, 90);
               g.drawString( "Number of entries:" + counter, 30, 135);
               showStatus ("The Greatest Common Divisor:" + result);
             int gcd (int xvalue, int yvalue)
              if ( yvalue == 0 )
                  return xvalue;
              else
                   return gcd ( yvalue, ( xvalue % yvalue ) );
         public void actionPerformed ( ActionEvent e)
             showStatus("");
             drawResults = true;
             counter++;
             repaint();
    }

  • Could someone please explain how to check for flashback, to a beginner?

    Could someone please explain how to check for flashback, to a beginner?  Thanks.

    Install all of the available software updates.  If you have flashback it will be automatically removed.

  • Could someone please sketch out this simple script for me?

    Could someone please sketch out a simple java script for me. I will have a document with one background
    layer and a layer set (group) called "Analyze" that consists of 63 adjustment layers. The layer names in that "Analyze" group(folder) will be
    "01" ...through "63" with 01 on the bottom and 63 at the top. Initially, all of the adjustment layers will be invisible and  the
    group will be closed (not expanded). I need a simple  script that will check for the first invisible layer in that group
    and make it visible without selecting that layer nor expanding the group. The script has to check
    for the first invisible layer every time it runs because other actions may have turned off a layer in the set.
    The point of this is so I can hotkey flipping on the layers one at a time without expanding the set or
    changing focus off the  background. It seems it should be a simple loop, but I just can't wrap  my head
    around all the objects (e.g. Layer as opposed to Layers  and  Artlayer as opposed to Artlayers)
    and the constants constants.
    for (i = 63; i>0; i--){                 /* I have found layer indexes 0 are the topmost layer */
      if( layerset[i] == INVISIBLE){
               layerset[i] = VISIBLE;
                  break;
    Could someone please write me a simple script that would do this?
    Edit I found this and its very close to what I need:
    var doc = app.activeDocument;
    for(var i = 0 ; i < doc.layers.length;i++){
      doc.layers[i].visible = (i % 2 == 0);
    From here : Function to show/hide layer with Photoshop script (JSX) - Stack Overflow
    In my case I would rewrite it to this
    for(var i = 62; i >=0; i--){
         if(  !doc.layers[i].visible){
              doc.layers[i].visible =TRUE;
              break;
    My problem is I just need  to traverse the layers in my layerset "Analyze"
    How do  I reference just those? Is there a doc.layersets["Analyze"].layers[i].visible = TRUE?
    Message was edited by: Shawn Laughlin To add more information

    Well this works:
    var doc = app.activeDocument;
    var analyze = doc.layerSets.getByName("Analyze").layers
    for(var i = 62 ; i >= 0; i --){
        if (!analyze[i].visible){
            analyze[i].visible =1;
            break;
    Hard to believe TRUE is not a constant in java.

  • HT2305 Could someone please give me instructions on how to update my ipad 1 to iOS 5.1?

    Could someone please give me instructions on how to update my ipad 1 to iOS 5 or above?

    If you have an iPad 1, the max iOS is 5.1.1. For newer iPads, the current iOS is 6.1. The Settings>General>Software Update only appears if you have iOS 5.0 or higher currently installed.
    iOS 5: Updating your device to iOS 5 or Later
    http://support.apple.com/kb/HT4972
    How to install iOS 6
    http://www.macworld.com/article/2010061/hands-on-with-ios-6-installation.html
    iOS: How to update your iPhone, iPad, or iPod touch
    http://support.apple.com/kb/HT4623
    If you are currently running an iOS lower than 5.0, connect the iPad to the computer, open iTunes. Then select the iPad under the Devices heading on the left, click on the Summary tab and then click on Check for Update.
    Tip - If connected to your computer, you may need to disable your firewall and anitvirus software temporarily.  Then download and install the iOS update. Be sure and backup your iPad before the iOS update. After you update an iPad (except iPad 1) to iOS 6.x, the next update can be installed via wifi (i.e., not connected to your computer).
     Cheers, Tom

  • Some users are experiencing difficulty opening certain docx files sent as email attachments. These files contain content controls to protect data in the document. Could someone please confirm that the content controls are the reason the files won't open.

    Some users are experiencing difficulty opening certain docx files sent as email attachments. These files contain content controls to protect data in the document. Could someone please confirm that the content controls are the reason the files won't open.
    These files open correctly when sent as doc files.
    Thanks

    Congrats to Saeid, Ronen, and Ricardo! Big thank you to all our contributors!
     Transact-SQL Technical Guru - February 2015  
    Saeid Hasani
    T-SQL: How the Order of Elements in the ORDER BY Clause Implemented in the Output Result
    Durval Ramos: "Very well structured and with examples that clarify how a T-SQL statement can change the data output order."
    Richard Mueller: "Good use of Wiki guidelines and great examples."
    Ronen Ariely
    Free E-Books about SQL and Transact-SQL languages
    Richard Mueller: "An excellent collection and a great idea."
    Durval Ramos: "A good initiative. Very useful !!!"
    Ricardo Lacerda
    Declare Cursor (Transact-SQL) versus Window with Over - Running Totals
    - Accumulated Earnings
    Durval Ramos: "The "Window function" sample was well presented, but it was unclear how the chart was generated."
    Richard Mueller: "A new idea that can be very useful. Grammar needs work"
    Also worth a mention were the other entries this month:
    [T-SQL] Retrieve Table List with Number of Rows by
    Emiliano Musso
    Richard Mueller: "Short but sweet solution to basic question."
    Durval Ramos: "A simple T-SQL script, but useful."
    [T-SQL] Search for Missing Values within a Numerical Sequence by
    Emiliano Musso
    Richard Mueller: "Clever solution with good code examples."
    Durval Ramos: "You need add more details about development of the idea and create a "Conclusion" section to easy understanding."
    [T-SQL] Converting Multiple Rows into HTML Format single ROW by
    Maheen Khizar (Bint-e-Adam)
    Durval Ramos: "In some situations, It's need to consume and format HTML tags for a UI, but It's important to remember that Best Practices recommend this formatting process preferably in Presentation Layer"
    Richard Mueller: "A great new idea. Some features need more explanation. Avoid first person."
    Ed Price, Azure & Power BI Customer Program Manager (Blog,
    Small Basic,
    Wiki Ninjas,
    Wiki)
    Answer an interesting question?
    Create a wiki article about it!

  • Could someone please run a small test?

    Hello out there,
    I am getting this compiler error where everything I have read says that what I do should be ok: My interest is to create a 'package level' variable - accessible from any class in the package.
    Could someone please perform the following 3 steps and report the results here?
    1) Paste the following code into a file Dummy.as located in a suitable directory - adapt the name components accordingly.
    package components {
        import flash.display.Sprite;
        var thingies:Array = new Array();          // this is the object of interest
        public class Dummy extends Sprite {}
    Your project should still compile - Dummy is not really used.
    2) In another component (which of course needs to be active in your project) add a variable like
         var dummy:Dummy;
    3) Does it still compile? That's the big question.
    When I do this I get the error message
         A file found in a source-path can not have more than one externally visible definition
              components:thingies;components:Dummy
    Bumm - show stopper.
    BTW the product is Flex Builder 3.0 build (3.0.2.214193)
    Thanks and best regards
    Helmut

    This page indicates the variable should be in the class (and that works for your test code):
    http://www.judahfrangipane.com/blog/?p=60
    If this post answered your question or helped, please mark it as such.

  • Could someone please advise on my current problem? Apparantly I can no longer download tones to my phone or account to be used as such since the tones are being downloaded as songs that cannot be transferred or placed in the tones area for the phone...

    Could someone please advise on my current problem? Apparantly I can no longer download tones to my phone or account to be used as such since the tones are being downloaded as songs that cannot be transferred or placed in the tones area for the phone or in iTunes. Prior to the last update, this was always an option. I have also noticed that the Ringtones and Alert Tones are not showing up in my recent purchases as well to allow for me to place them back on my phone and there for require for them to be purchased again... Any help would be greatly appreciated!

    I've discovered that all tones purchased will be downloaded as ringtones, BUT they can be utilized as tones and assigned as alert tones on the iPhone...

  • Could someone please help me with getting the sabnzbd daemon to start?

    Hi everyone,
    I'm a classic newbie.  I managed to follow some instructions I found on the web to get sabnzbd to install (via Yaourt), and when I invoke it from the command line, it works fine.
    I've read that you can get it to start as a daemon, which would be really good.  Could someone please explain how this should be done?
    Where do I need to put the sabnzbd.init file?
    What about the sabnzbd.confd file?
    I'm okay enough with adding sabnzbd to the /etc/rc.conf file, but I can't quite configure it so that the necessary files are in place to start it.
    If you need any details of my setup, please let me know.
    Thanks heaps,
    Luke

    birdie101 wrote:Where would I find a good place to describe how to install programs using PKGBUILDs?  and what that process is actually doing?
    Apart from the wiki article on ABS, always look at the pkgbuild when in doubt. This is also helpful when you want to know what compile arguments are passed to GCC. Custom postinstall commands are run through .install file (example what is displayed after installation), this is generally foo.install in the AUR for a pkg named foo. And most importantly, familiarize yourself with compiling process, and Arch specific routines like a daemon should be defined in /etc/rc.d/, instead of /etc/init.d/ in other linuxes.
    Edit: A best exercise would be to create a pkgbuild yourself. Arch always recommends community contributions.
    Last edited by shemz (2010-09-24 08:08:14)

  • I recently had my computer fixed. there was a million viruses in it, but when i got home and logged onto my second apple id, i found that bonjour was no longer installed. could someone please advise me on how to install bonjour onto my computer?thnx

    i recently had my computer fixed as it was loaded with viruses. Also I finally got my IPad 1 back from someone who had "borrowed" it for a year. It no longer worked, but in the case i had written down my old apple id. i had purchased 3 other ipad's since then and changed my id. i typed the old id and was delighted to see that i had over $1000 worth of dowmloaded media. i want to use this old acct number on one of my other IPads to avoid confusing two accts, but when i attempted transferring media onto computer it said i needed to first download bonjour. i have been trying to figure out how, but computer genius i am NOT. could someone please help me? i really appreciate any advice you could offer steering me in the right direction with this. thank you, stacey v

    Hey staceylynn261!
    Bonjour is a program that is installed on your computer along with iTunes, so you will want to first uninstall iTunes and all of its related components:
    Removing and reinstalling iTunes and other software components for Windows Vista, Windows 7, or Windows 8
    http://support.apple.com/kb/HT1923
    You will then want to visit this link to download and install the latest version of iTunes:
    Apple - iTunes - Download iTunes Now
    http://www.apple.com/itunes/download/
    Thanks for using the Apple Support Communities. Have a good one!
    -Braden

  • Could someone please explain what P to P and Order to Cash cycle?

    Could someone please explain what Procurement to Pay and Order to Cash cycles mean? Thanks.

    Hi,
    Pl.visit following links for P2P cycle.
    http://erpschools.com/articles/procure-to-pay-cycle#13480480234441&79412::resize_frame
    http://oracleapplicationsfunctional.blogspot.in/2011/08/procure-to-pay-p2p-cycle-in-purchasing.html
    http://www.shareoracleapps.com/2010/05/procure-to-pay-cycle-in-oracle-apps-r12.html
    and visit following links for O2C cycle.
    http://erpschools.com/articles/order-to-cash-cycle#13480481951911&21367::resize_frame
    http://www.youtube.com/watch?v=2GhAbWGz7iA
    http://knoworacle.wordpress.com/2008/12/08/data-flow-for-11i-order-to-cash-cycle/
    http://oracleapps88.blogspot.in/2012/08/order-to-cash-cycle.html
    http://www.slideshare.net/anand5538/order-to-cash-cycle-9647606
    HTH
    Sanjay

  • Please check the code

    I AM TRYING TO REPLICATE THE ADDRESS OF EQUIPMENT FROM ECC TO CRM.
    I AM ABLE TO REPLICATE THE IDENTIFICATION NUMBER.
    WHILE USING THE SAME FUNCTION MODULE FOR ADDRESS, THE ADDRESS IS NOT GETTING REPLICATED.
    PLEASE CHECK THE CODE AND TELL ME WHAT PRE-REQUISITES MUST BE TAKEN INTO CONSIDERATION AND IS THERE ANY MISTAKE FROM ME.
    FULL POINTS WILL BE REWARDED.
    ITS VERY VERY URGENT.
    METHOD IF_EX_CRM_EQUI_LOAD~ENLARGE_COMPONENT_DATA.
    **Data declarations
    DATA:
        ls_equi          type crmt_equi_mess,
        ls_comp          type ibap_dat1,
        ls_comp_det1     TYPE IBAP_COMP3,
        ls_address_data  type ADDR1_DATA,
        ls_object      type comt_product_maintain_api,
        ls_object1     type comt_product,
        lv_object_id   type IB_DEVICEID,
        lv_object_guid type IB_OBJNR_GUID16.
    **Map Sort field from ECC to CRM
    Read table it_equi_dmbdoc-equi into ls_equi index 1.
    lv_object_id  = ls_equi-equnr.
    move is_object to ls_object.
    move ls_object-com_product to ls_object1.
    lv_object_guid = ls_object1-product_guid.
    move is_component to ls_comp.
    ls_comp_det1-deviceid    = lv_object_id.
    ls_comp_det1-object_guid = lv_object_guid.
    ls_comp_det1-EXTOBJTYP   = 'CRM_OBJECT'.
    ls_comp_det1-ibase       = ls_comp-ibase.
    ls_address_data-roomnumber = '1000'.
    ls_address_data-floor = '10'.
    ls_address_data-country = 'US'.
    CALL FUNCTION 'CRM_IBASE_COMP_CHANGE'
      EXPORTING
       i_comp                       = ls_comp
       I_COMP_DET             = ls_comp_det1
       I_ADDRESS_DATA     = ls_address_data
      I_ADDRESS_ADMIN           =
      I_PARTNER                 =
      I_DATE                    =
      I_TIME                    =
    EXCEPTIONS
      DATA_NOT_CONSISTENT       = 1
      IBASE_LOCKED              = 2
      NOT_SUCCESFUL             = 3
      OTHERS                    = 4
    *IF sy-subrc <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    *ENDIF.
    ENDMETHOD.

    Hi S B,
    May I the procedure for the replication of serialnumber into device ID that is Identification field In Ibase.
    And one more thing need this to be codded in the standard badi or needed an copy of the implementation .
    plz help me as u already have done the requirement.
    u will be twice rewarded.
    Thanking u in advance for the reply.
    Sree.

  • My husband and I both have types of IPods but we can not download any music to them because we have an Acer Android tablets. Could someone please help us to be able to download music to our IPods all we have is this tablet

    We have two types of Ipods. A nano generation 5 & a nano touch, and we are unable to download music to them was told its because we have an Acer Android tablet. Could someone please help us in solving this issuses cause we just bought these ipods and was not aware that and all we have is this tablet. .. Please help us

    Templeton Peck, the Android tablet  does not support iTunes
    Angs78, you purchase music from iTunes on the iPod touch. I know of no way to get music on the Nanao from the tablet.

Maybe you are looking for