String to int. Whats wrong?

Whats wrong with this?
int costInt;
String costString;
costString = rs.getString("COST");
costInt = Integer.parseInt(costString);
I get this exception:
Error page exception
The server cannot use the error page specified for your application to handle the Original Exception printed below. Please see the Error Page Exception below for a description of the problem with the specified error page.
Original Exception:
Error Message: 100,00
Error Code: 500
Target Servlet: null
Error Stack:
java.lang.NumberFormatException: 100,00
at java.lang.Integer.parseInt(Integer.java:415)
at java.lang.Integer.parseInt(Integer.java:455)
at com.bright.coffeeplease.persistence.ProductPersister.getProductList(ProductPersister.java:74)
at updateproduct_jsp_38._jspService(updateproduct_jsp_38.java:130)
at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:139)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at org.apache.jasper.runtime.JspServlet$JspServletWrapper.service(JspServlet.java:286)
at org.apache.jasper.runtime.JspServlet.serviceJspFile(JspServlet.java:415)
at org.apache.jasper.runtime.JspServlet.service(JspServlet.java:544)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at com.ibm.servlet.engine.webapp.StrictServletInstance.doService(ServletManager.java:827)
at com.ibm.servlet.engine.webapp.StrictLifecycleServlet._service(StrictLifecycleServlet.java:159)
at com.ibm.servlet.engine.webapp.IdleServletState.service(StrictLifecycleServlet.java:286)
at com.ibm.servlet.engine.webapp.StrictLifecycleServlet.service(StrictLifecycleServlet.java:106)
at com.ibm.servlet.engine.webapp.ServletInstance.service(ServletManager.java:472)
at com.ibm.servlet.engine.webapp.ValidServletReferenceState.dispatch(ServletManager.java:1012)
at com.ibm.servlet.engine.webapp.ServletInstanceReference.dispatch(ServletManager.java:913)
at com.ibm.servlet.engine.webapp.WebAppRequestDispatcher.handleWebAppDispatch(WebAppRequestDispatcher.java:403)
at com.ibm.servlet.engine.webapp.WebAppRequestDispatcher.dispatch(WebAppRequestDispatcher.java:227)
at com.ibm.servlet.engine.webapp.WebAppRequestDispatcher.forward(WebAppRequestDispatcher.java:98)
at com.ibm.servlet.engine.srt.WebAppInvoker.doForward(WebAppInvoker.java:67)
at com.ibm.servlet.engine.srt.WebAppInvoker.handleInvocationHook(WebAppInvoker.java:123)
at com.ibm.servlet.engine.invocation.CachedInvocation.handleInvocation(CachedInvocation.java:67)
at com.ibm.servlet.engine.invocation.CacheableInvocationContext.invoke(CacheableInvocationContext.java:106)
at com.ibm.servlet.engine.srp.ServletRequestProcessor.dispatchByURI(ServletRequestProcessor.java:125)
at com.ibm.servlet.engine.oselistener.OSEListenerDispatcher.service(OSEListener.java:315)
at com.ibm.servlet.engine.http11.HttpConnection.handleRequest(HttpConnection.java:60)
at com.ibm.ws.http.HttpConnection.readAndHandleRequest(HttpConnection.java:313)
at com.ibm.ws.http.HttpConnection.run(HttpConnection.java:242)
at com.ibm.ws.util.CachedThread.run(ThreadPool.java:122)
Error Page Exception:
Error Message: JSPG0113E: JSP file "C:\My Documents\coffee\webApplication\error.jsp (The system cannot find the file specified)" not found
Error Code: 404
Target Servlet: JSP 1.1 Processor
Error Stack:
com.ibm.servlet.engine.webapp.WebAppErrorReport: JSPG0113E: JSP file "C:\My Documents\coffee\webApplication\error.jsp (The system cannot find the file specified)" not found
at com.ibm.servlet.engine.webapp.WebAppDispatcherResponse.sendError(WebAppDispatcherResponse.java:97)
at org.apache.jasper.runtime.JspServlet$JspServletWrapper.service(JspServlet.java:296)
at org.apache.jasper.runtime.JspServlet.serviceJspFile(JspServlet.java:415)
at org.apache.jasper.runtime.JspServlet.service(JspServlet.java:544)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at com.ibm.servlet.engine.webapp.StrictServletInstance.doService(ServletManager.java:827)
at com.ibm.servlet.engine.webapp.StrictLifecycleServlet._service(StrictLifecycleServlet.java:159)
at com.ibm.servlet.engine.webapp.IdleServletState.service(StrictLifecycleServlet.java:286)
at com.ibm.servlet.engine.webapp.StrictLifecycleServlet.service(StrictLifecycleServlet.java:106)
at com.ibm.servlet.engine.webapp.ServletInstance.service(ServletManager.java:472)
at com.ibm.servlet.engine.webapp.ValidServletReferenceState.dispatch(ServletManager.java:1012)
at com.ibm.servlet.engine.webapp.ServletInstanceReference.dispatch(ServletManager.java:913)
at com.ibm.servlet.engine.webapp.WebAppRequestDispatcher.handleWebAppDispatch(WebAppRequestDispatcher.java:403)
at com.ibm.servlet.engine.webapp.WebAppRequestDispatcher.dispatch(WebAppRequestDispatcher.java:227)
at com.ibm.servlet.engine.webapp.WebAppRequestDispatcher.include(WebAppRequestDispatcher.java:104)
at com.ibm.servlet.engine.webapp.WebApp.sendError(WebApp.java:620)
at com.ibm.servlet.engine.webapp.WebApp.sendError(WebApp.java:546)
at com.ibm.servlet.engine.srt.WebAppInvoker.doForward(WebAppInvoker.java:92)
at com.ibm.servlet.engine.srt.WebAppInvoker.handleInvocationHook(WebAppInvoker.java:123)
at com.ibm.servlet.engine.invocation.CachedInvocation.handleInvocation(CachedInvocation.java:67)
at com.ibm.servlet.engine.invocation.CacheableInvocationContext.invoke(CacheableInvocationContext.java:106)
at com.ibm.servlet.engine.srp.ServletRequestProcessor.dispatchByURI(ServletRequestProcessor.java:125)
at com.ibm.servlet.engine.oselistener.OSEListenerDispatcher.service(OSEListener.java:315)
at com.ibm.servlet.engine.http11.HttpConnection.handleRequest(HttpConnection.java:60)
at com.ibm.ws.http.HttpConnection.readAndHandleRequest(HttpConnection.java:313)
at com.ibm.ws.http.HttpConnection.run(HttpConnection.java:242)
at com.ibm.ws.util.CachedThread.run(ThreadPool.java:122)

BTW, are you sure that the data type of the column "COST" is a numeric value in the DB, i.e. you are not storing it as a String??
Plus also have a look at the following post to see how your locale settings can effect these things
http://forum.java.sun.com/thread.jsp?forum=1&thread=168441
Hope this helps
Regards
Omer

Similar Messages

  • Does not print the string value ? what is wrong here

    Hi,
    I am trying to print the string value that does not have spaces.
    when I do that,I dont get what I want i.e 3334445555.
    Any help in this regard is appreciated.
    Thanks
    Chat
    import java.util.StringTokenizer;
    class TestTokenizer{
    public static void main(String args[]){
              StringTokenizer st = new StringTokenizer(" 333 444 5555");
              String tokens[] =new String[3];
              int i=1;
              while (st.hasMoreTokens()) {
                   //System.out.println(st.nextToken());
                   tokens=st.nextToken();
              System.out.println(tokens.toString());

    also, be sure to format your code in your next post...click the code button at the top of the message box you type in, and past your code
    *here*[\code]                                                                                                                                                                                                                                                                                                                               

  • String index outof bound whatis wrong

    can u please tell while reading <edm:OrderItem><edm:OrderItemReconciliation orderREF="1036578"/></edm:OrderItem> i got string index out of bound exception..what is wrong in code
    final String START6_TAG="orderREF=";
                   final String END6_TAG=">";
                   final String END7_TAG="/>";
    if(line.indexOf(START6_TAG)> -1 ) {                               if(line.indexOf(END7_TAG)>-1){
                             //efound9=true;
                                  if(efound9==false)
                                       System.out.println("hello");
                                       // start5Pos = line.indexOf(START6_TAG)+1;
                                       start5Pos = line.indexOf(START6_TAG)+1;
                                            System.out.println("index"+START6_TAG);
                                            System.out.println("index"+start5Pos);
                                            start5Pos += START6_TAG.length();
                                            System.out.println("length"+start5Pos);
                                       // end5Pos = line.indexOf(END6_TAG)-2;
                                            end5Pos = line.indexOf("\">",start5Pos);
                                            System.out.println("index"+ end5Pos );
                                            efound7=true;
                                            //while (endPos == -1 && line != null)
                             else
                                  efound7=false;

    zadok ,thanks for reply i got following errror....while writing to file because end index becomes -1
    Error: java.lang.StringIndexOutOfBoundsException: String index out of range: -55
    java.lang.StringIndexOutOfBoundsException: String index out of range: -55
         at java.lang.String.substring(Unknown Source)
         at TestReader35.main(TestReader35.java:870)
    i forget to add the exception comes on line if ((efound7 == true))
                             br1.write("\t");
                             System.out.println("startposition"+start5Pos);
                             //System.out.println("startposition"+start5Pos);
                             System.out.println("end5position"+end5Pos);
                             //System.out.println("startposition"+start5Pos);
                             System.out.println("Exception occured"+line);
                             br1.write(line.substring(start5Pos,end5Pos));
                             //br1.write((START2_TAG)+line.substring(startPos,endPos)+(END2_TAG));
                        br1.flush();
                        } else {
                             System.out.println("efound6 Not found");
    some times that program needs to handle
    <edm:OrderItem><edm:OrderItemReconciliation orderREF="1036578">also only one1036578 need to be taken,can u please tell me what wrong in code

  • Replacing String month with type Int - What to do!?!

    import java.util.Scanner;
    public class Date
        private String month;
        private int day;
        private int year; //a four digit number.
        public Date( )
            month = "January";
            day = 1;
            year = 1000;
        public Date(int monthInt, int day, int year)
            setDate(monthInt, day, year);
        public Date(String monthString, int day, int year)
            setDate(monthString, day, year);
        public Date(int year)
            setDate(1, 1, year);
        public Date(Date aDate)
            if (aDate == null)//Not a real date.
                 System.out.println("Fatal Error.");
                 System.exit(0);
            month = aDate.month;
            day = aDate.day;
            year = aDate.year;
        public void setDate(int monthInt, int day, int year)
            if (dateOK(monthInt, day, year))
                this.month = monthString(monthInt);
                this.day = day;
                this.year = year;
            else
                System.out.println("Fatal Error");
                System.exit(0);
        public void setDate(String monthString, int day, int year)
            if (dateOK(monthString, day, year))
                this.month = monthString;
                this.day = day;
                this.year = year;
            else
                System.out.println("Fatal Error");
                System.exit(0);
        public void setDate(int year)
            setDate(1, 1, year);
        public void setYear(int year)
            if ( (year < 1000) || (year > 9999) )
                System.out.println("Fatal Error");
                System.exit(0);
            else
                this.year = year;
        public void setMonth(int monthNumber)
            if ((monthNumber <= 0) || (monthNumber > 12))
                System.out.println("Fatal Error");
                System.exit(0);
            else
                month = monthString(monthNumber);
        public void setDay(int day)
            if ((day <= 0) || (day > 31))
                System.out.println("Fatal Error");
                System.exit(0);
            else
                this.day = day;
        public int getMonth( )
            if (month.equals("January"))
                return 1;
            else if (month.equals("February"))
                return 2;
            else if (month.equalsIgnoreCase("March"))
                return 3;
            else if (month.equalsIgnoreCase("April"))
                return 4;
            else if (month.equalsIgnoreCase("May"))
                return 5;
            else if (month.equals("June"))
                return 6;
            else if (month.equalsIgnoreCase("July"))
                return 7;
            else if (month.equalsIgnoreCase("August"))
                return 8;
            else if (month.equalsIgnoreCase("September"))
                return 9;
            else if (month.equalsIgnoreCase("October"))
                return 10;
            else if (month.equals("November"))
                return 11;
            else if (month.equals("December"))
                return 12;
            else
                System.out.println("Fatal Error");
                System.exit(0);
                return 0; //Needed to keep the compiler happy
        public int getDay( )
            return day;
        public int getYear( )
            return year;
        public String toString( )
            return (month + " " + day + ", " + year);
        public boolean equals(Date otherDate)
            return ( (month.equals(otherDate.month))
                      && (day == otherDate.day) && (year == otherDate.year) );
        public boolean precedes(Date otherDate)
            return ( (year < otherDate.year) ||
               (year == otherDate.year && getMonth( ) < otherDate.getMonth( )) ||
               (year == otherDate.year && month.equals(otherDate.month)
                                             && day < otherDate.day) );
        public void readInput( )
            boolean tryAgain = true;
            Scanner keyboard = new Scanner(System.in);
            while (tryAgain)
                System.out.println("Enter month, day, and year.");
                  System.out.println("Do not use a comma.");
                String monthInput = keyboard.next( );
                int dayInput = keyboard.nextInt( );
                int yearInput = keyboard.nextInt( );
                if (dateOK(monthInput, dayInput, yearInput) )
                    setDate(monthInput, dayInput, yearInput);
                    tryAgain = false;
                else
                    System.out.println("Illegal date. Reenter input.");
        private boolean dateOK(int monthInt, int dayInt, int yearInt)
            return ( (monthInt >= 1) && (monthInt <= 12) &&
                     (dayInt >= 1) && (dayInt <= 31) &&
                     (yearInt >= 1000) && (yearInt <= 9999) );
        private boolean dateOK(String monthString, int dayInt, int yearInt)
            return ( monthOK(monthString) &&
                     (dayInt >= 1) && (dayInt <= 31) &&
                     (yearInt >= 1000) && (yearInt <= 9999) );
        private boolean monthOK(String month)
            return (month.equals("January") || month.equals("February") ||
                    month.equals("March") || month.equals("April") ||
                    month.equals("May") || month.equals("June") ||
                    month.equals("July") || month.equals("August") ||
                    month.equals("September") || month.equals("October") ||
                    month.equals("November") || month.equals("December") );
        private String monthString(int monthNumber)
            switch (monthNumber)
            case 1:
                return "January";
            case 2:
                return "February";
            case 3:
                return "March";
            case 4:
                return "April";
            case 5:
                return "May";
            case 6:
                return "June";
            case 7:
                return "July";
            case 8:
                return "August";
            case 9:
                return "September";
            case 10:
                return "October";
            case 11:
                return "November";
            case 12:
                return "December";
            default:
                System.out.println("Fatal Error");
                System.exit(0);
                return "Error"; //to keep the compiler happy
    }My question is that if I were to change the String month in the instance variables to type int, what changes do I make to the code to make this work WITHOUT changing the method headings and it also says that none of the type String paraenters should change to type int. I need to redefine the methods to make it work. I've been at this for hours and am just stuck so this is the reason for my early morning post.

    import java.util.Scanner;
    public class Date
        private int month;
        private int day;
        private int year; //a four digit number.
        public Date( )
            month = 1;
            day = 1;
            year = 1000;
        public Date(int monthInt, int day, int year)
            setDate(monthInt, day, year);
        public Date(String monthString, int day, int year)
            setDate(monthString, day, year);
        public Date(int year)
            setDate(1, 1, year);
        public Date(Date aDate)
            if (aDate == null)//Not a real date.
                 System.out.println("Fatal Error.");
                 System.exit(0);
            month = aDate.month;
            day = aDate.day;
            year = aDate.year;
        public void setDate(int monthInt, int day, int year)
            if (dateOK(monthInt, day, year))
                this.month = monthInt;
                this.day = day;
                this.year = year;
            else
                System.out.println("Fatal Error");
                System.exit(0);
        public void setDate(String monthString, int day, int year)
            if (dateOK(monthString, day, year))
                this.month = monthStringToInt(monthString);
                this.day = day;
                this.year = year;
            else
                System.out.println("Fatal Error");
                System.exit(0);
        public void setDate(int year)
            setDate(1, 1, year);
        public void setYear(int year)
            if ( (year < 1000) || (year > 9999) )
                System.out.println("Fatal Error");
                System.exit(0);
            else
                this.year = year;
        public void setMonth(int monthNumber)
            if ((monthNumber <= 0) || (monthNumber > 12))
                System.out.println("Fatal Error");
                System.exit(0);
            else
                month = monthNumber;
        public void setDay(int day)
            if ((day <= 0) || (day > 31))
                System.out.println("Fatal Error");
                System.exit(0);
            else
                this.day = day;
        public int getMonth( )
             return month;
        public int getDay( )
            return day;
        public int getYear( )
            return year;
        public String toString( )
            return (month + " " + day + ", " + year);
        public boolean equals(Date otherDate)
            return ( (month == otherDate.month)
                      && (day == otherDate.day) && (year == otherDate.year) );
        public boolean precedes(Date otherDate)
            return ( (year < otherDate.year) ||
               (year == otherDate.year && getMonth( ) < otherDate.getMonth( )) ||
               (year == otherDate.year && month == otherDate.month
                                             && day < otherDate.day) );
        public void readInput( )
            boolean tryAgain = true;
            Scanner keyboard = new Scanner(System.in);
            while (tryAgain)
                System.out.println("Enter month, day, and year.");
                  System.out.println("Do not use a comma.");
                String monthInput = keyboard.next( );
                int dayInput = keyboard.nextInt( );
                int yearInput = keyboard.nextInt( );
                if (dateOK(monthInput, dayInput, yearInput) )
                    setDate(monthInput, dayInput, yearInput);
                    tryAgain = false;
                else
                    System.out.println("Illegal date. Reenter input.");
        private boolean dateOK(int monthInt, int dayInt, int yearInt)
            return ( (monthInt >= 1) && (monthInt <= 12) &&
                     (dayInt >= 1) && (dayInt <= 31) &&
                     (yearInt >= 1000) && (yearInt <= 9999) );
        private boolean dateOK(String monthString, int dayInt, int yearInt)
            return ( monthOK(monthString) &&
                     (dayInt >= 1) && (dayInt <= 31) &&
                     (yearInt >= 1000) && (yearInt <= 9999) );
        private boolean monthOK(String month)
            return (month.equals("January") || month.equals("February") ||
                    month.equals("March") || month.equals("April") ||
                    month.equals("May") || month.equals("June") ||
                    month.equals("July") || month.equals("August") ||
                    month.equals("September") || month.equals("October") ||
                    month.equals("November") || month.equals("December") );
        private String monthString(int monthNumber)
            switch (monthNumber)
            case 1:
                return "January";
            case 2:
                return "February";
            case 3:
                return "March";
            case 4:
                return "April";
            case 5:
                return "May";
            case 6:
                return "June";
            case 7:
                return "July";
            case 8:
                return "August";
            case 9:
                return "September";
            case 10:
                return "October";
            case 11:
                return "November";
            case 12:
                return "December";
            default:
                System.out.println("Fatal Error");
                System.exit(0);
                return "Error"; //to keep the compiler happy
        private int monthStringToInt(String monthString) {
             if (monthString.equals("January")) return 1;
             else if (monthString.equals("February")) return 2;
             else if (monthString.equals("March")) return 3;
             else if (monthString.equals("April")) return 4;
             else if (monthString.equals("May")) return 5;
             else if (monthString.equals("June")) return 6;
             else if (monthString.equals("July")) return 7;
             else if (monthString.equals("August")) return 8;
             else if (monthString.equals("September")) return 9;
             else if (monthString.equals("October")) return 10;
             else if (monthString.equals("November")) return 11;
             else if (monthString.equals("December")) return 12;
             else return -1;
    }I've added one method: monthStringToInt to convert "January", "February" into an integer value. There are probably better ways to do this (Calendar), but this involes no other classes.

  • Whats wrong with this servlet code..?no error in log

    hello guys..hope one of you can help....
    i have 2 servlet classes. one receives form data sent from a jsp page, then create a form object containing all the inputs.. that object is then added to the session ..
    also, it construct a User object containing info about the present user and add it to the session.. IUser and Form are inner to the main class.
    the first servlet (check) seems to work fine.. but the problem occurs with the second servlet...i have inserted some printl statements to help me identify how far it goes and it seems that the whole code of the second servlet(update) is almost redundant....I dont get any error message ..simply a blank page which is of course of no help to me...
    I hate inserting long code here but i would be pleased if anyone could tell me of a way to find out about the actual problem..program compiles fine but..it just freezes at runtime
    ..here is part of the code..whats wrong?
    HttpSession session=request.getSession();
         User user2=(User)session.getAttribute("person");
         Form fr=(Form)session.getAttribute("form");
         System.out.println("User and Form created");
         int uid=user2.getId(); //class User contain the getId method
         String uname=user2.getName();
         System.out.println("Data for user retrieved");
         String goTo=fr.getC();
         String password = fr.getP();
    String email=fr.getE();
    String newName=fr.getN();
    System.out.println("data from form retrieved");
    thanks

    the first servlet was indeed supposed to ass all those attributes...
    but the thing is that the data being retrieved later were not of the type expected...
    i have now decided to proceed differently but I am a bit curious to lean more about something that you mentionned in relation to servlet listeners..i never thought of the need to remove all those attribute when the session times out...
    I thought that it was doned automatically with a call to session.invalidate().
    is that not the case?
    thanks

  • Whats wrong with the code?????

    Hi All
    Pls can anyone help me, what is wrong with the below code, when ever i tried giving 10 digit number to chk out whether it is prime or not it is giving an NumberFormatException to me, pls can anyone help me...
    class PrimeNo{
    public static void main(String args[])
    int a = Integer.parseInt(args[0]);
    int count=0;
    for(int i=2;i<a;i++){
    if(a%i==0)
    System.out.println(a+" is not a Prime Number");
    count = 1;
    break;
    if(count==0)
    System.out.println(a+" is a Prime Number");
    Thnx and rgrds
    Badri

    Just curious, since this has already been answered, but to simplify code, would it be possible to set it so that if the value is not a prime number, just do the value like so:
    if (//code determines it is prime)
    System.out.println ("prime number");
    else
    prime = !prime;
    if(!prime)
    System.out.println ("not a prime number");not really code there, more pseudocode, but you get my drift. Would this make sense to do?

  • HELP PLEASE - WHATS WRONG WITH THIS CODE

    Hi. I get this message coming up when I try to compile the code,
    run:
    java.lang.NullPointerException
    at sumcalculator.SumNumbers.<init>(SumNumbers.java:34)
    at sumcalculator.SumNumbers.main(SumNumbers.java:93)
    Exception in thread "main"
    Java Result: 1
    BUILD SUCCESSFUL (total time: 2 seconds)
    I am not sure whats wrong with the code. Any assistance would be nice. The code is below.
    package sumcalculator;
    import java.awt.*;
    import java.awt.event.*;
    import javax.swing.*;
    public class SumNumbers extends JFrame implements FocusListener {
    JTextField value1;
    JTextField value2;
    JLabel equals;
    JTextField sum;
    JButton add;
    JButton minus;
    JButton divide;
    JButton multiply;
    JLabel operation;
    public SumNumbers() {
    SumNumbersLayout customLayout = new SumNumbersLayout();
    getContentPane().setFont(new Font("Helvetica", Font.PLAIN, 12));
    getContentPane().setLayout(customLayout);
    value1.addFocusListener(this);
    value2.addFocusListener(this);
    sum.setEditable(true);
    value1 = new JTextField("");
    getContentPane().add(value1);
    value2 = new JTextField("");
    getContentPane().add(value2);
    equals = new JLabel("label_1");
    getContentPane().add(equals);
    sum = new JTextField("");
    getContentPane().add(sum);
    add = new JButton("+");
    getContentPane().add(add);
    minus = new JButton("-");
    getContentPane().add(minus);
    divide = new JButton("/");
    getContentPane().add(divide);
    multiply = new JButton("*");
    getContentPane().add(multiply);
    operation = new JLabel();
    getContentPane().add(operation);
    setSize(getPreferredSize());
    addWindowListener(new WindowAdapter() {
    public void windowClosing(WindowEvent e) {
    System.exit(0);
    public void focusGained(FocusEvent event){
    try {
    float total = Float.parseFloat(value1.getText()) +
    Float.parseFloat(value2.getText());
    sum.setText("" + total);
    } catch (NumberFormatException nfe) {
    value1.setText("0");
    value2.setText("0");
    sum.setText("0");
    public void focusLost(FocusEvent event){
    focusGained(event);
    public static void main(String args[]) {
    SumNumbers window = new SumNumbers();
    window.setTitle("SumNumbers");
    window.pack();
    window.show();
    class SumNumbersLayout implements LayoutManager {
    public SumNumbersLayout() {
    public void addLayoutComponent(String name, Component comp) {
    public void removeLayoutComponent(Component comp) {
    public Dimension preferredLayoutSize(Container parent) {
    Dimension dim = new Dimension(0, 0);
    Insets insets = parent.getInsets();
    dim.width = 711 + insets.left + insets.right;
    dim.height = 240 + insets.top + insets.bottom;
    return dim;
    public Dimension minimumLayoutSize(Container parent) {
    Dimension dim = new Dimension(0, 0);
    return dim;
    public void layoutContainer(Container parent) {
    Insets insets = parent.getInsets();
    Component c;
    c = parent.getComponent(0);
    if (c.isVisible()) {c.setBounds(insets.left+24,insets.top+48,128,40);}
    c = parent.getComponent(1);
    if (c.isVisible()) {c.setBounds(insets.left+256,insets.top+48,128,40);}
    c = parent.getComponent(2);
    if (c.isVisible()) {c.setBounds(insets.left+408,insets.top+48,56,40);}
    c = parent.getComponent(3);
    if (c.isVisible()) {c.setBounds(insets.left+488,insets.top+48,152,40);}
    c = parent.getComponent(4);
    if (c.isVisible()) {c.setBounds(insets.left+128,insets.top+136,72,40);}
    c = parent.getComponent(5);
    if (c.isVisible()) {c.setBounds(insets.left+248,insets.top+136,72,40);}
    c = parent.getComponent(6);
    if (c.isVisible()) {c.setBounds(insets.left+368,insets.top+136,72,40);}
    c = parent.getComponent(7);
    if (c.isVisible()) {c.setBounds(insets.left+488,insets.top+136,72,40);}
    c = parent.getComponent(8);
    if (c.isVisible()) {c.setBounds(insets.left+176,insets.top+48,56,40);}
    }

    Thank you. How do i amend this? I have defined value1though.Yes, you did - but after the call to addFocusListener(...). It needs to be before it.
    BTW, you did the same thing with "value2.addFocusListener(this)" and "sum.setEditable(true)" on the next two lines. You're attempting to call a method on an object that doesn't exist yet (i.e., you haven't called new yet).

  • String unicode -- understanding what is happening

    Hi,
    Can some one please explain how the following is working in string
    Case1:
    1) Assume I have set of bytes encoded in UTF-8.
    2)Iam reading the UTF-8 bytes using inputstreamreader and store it in string
    3) I know string stores it in unicode -- But what encoding? (UCS-2 or UTF-8 etc)
    Case 3:
    4) Suppose SJIS bytes are encoded using UTF-8 and Iam reading using UTF-8 and storing it in String and then printing it using System.out.println()(locale is set to SJIS), who does the converstion from Unicode representation of the string to SJIS
    Case 2:
    * Bytes are SJIS encoded
    * Read it using UTF-8 ( wrong encoding used to read)
    * Store it in string . How will it store?
    * Print it using System.out.println in a machine whose locale is set to SJIS.
    * Who is doing the conversin from unicode to SJIS

    Guessing...
    Case1:
    1) Assume I have set of bytes encoded in UTF-8.
    2)Iam reading the UTF-8 bytes using
    inputstreamreader and store it in string
    3) I know string stores it in unicode -- But what
    encoding? (UCS-2 or UTF-8 etc)
    Depends on how you 'store' it. If you use String explicitly then the default encoding of the system is used. If you use String explicitly with an encoding then that encoding is used.
    Most, but not all (bugs), implicit conversions for readers use the default encoding.
    Case 3:
    4) Suppose SJIS bytes are encoded using UTF-8 and Iam
    reading using UTF-8 and storing it in String and then
    printing it using System.out.println()(locale is set
    to SJIS), who does the converstion from Unicode
    representation of the string to SJIS
    What conversion? If it is a String then it is UTF-8. If you 'display' it then it uses the OS encoding.
    Case 2:
    * Bytes are SJIS encoded
    * Read it using UTF-8 ( wrong encoding used to
    o read)
    * Store it in string . How will it store?Garbage for the most part.
    * Print it using System.out.println in a machine
    e whose locale is set to SJIS.
    * Who is doing the conversin from unicode to SJIS
    Garbage in, Garbage out.
    By the way there is a Internationalization forum and presumably you could get answers there.

  • What wrong with date ?

    I have a field, type date and some records with date : 14-nov-2005,
    My problem is when I run the sql, the record did not show up,
    SELECT ORDNUM,TO_CHAR(OREG_PRN_DT,'DD-MON-YYYY') FROM ORDER_H
    WHERE OREG_PRN_DT='14-NOV-2005'
    result---------
    no rows selected
    BUT
    SELECT ORDNUM,TO_CHAR(OREG_PRN_DT,'DD-MON-YYYY') FROM ORDER_H
    WHERE TO_CHAR(OREG_PRN_DT,'DD-MON-YYYY')='14-NOV-2005'
    --result
    ORDNUM TO_CHAR(ORE
    54360 14-NOV-2005
    53106 14-NOV-2005
    2 rows selected.
    What wrong ???? anybody can help ?
    Actually I have another date, but everything is ok, accept 14-nov-2005.
    Thank

    Yet again, I took too long putting an example together! :-)
    Anyway, might as well post it....
    Hello
    it must be the season for date issues! :-)
    Anyway, the first part of the problem is that in your first query, optimiser to convert the string '14-NOV-2005' into a date as can be seen with the following test:
    SQL> create table dt_test_date (dt date)
      2  /
    Table created.
    SQL> insert into dt_test_date values(sysdate)
      2  /
    1 row created.
    SQL> insert into dt_test_date values(sysdate + 1)
      2  /
    1 row created.
    SQL> select * from dt_test_date
      2  /
    DT
    03-AUG-06
    04-AUG-06
    SQL> select * from dt_test_date where dt=sysdate
      2  /
    no rows selected
    SQL> select * from dt_test_date where dt='03-AUG-06'
      2  /
    no rows selected
    SQL> select * from dt_test_date where TO_CHAR(dt,'DD-MON-YY')='03-AUG-06'
      2  /
    DT
    03-AUG-06
    SQL> select * from dt_test_date where dt='03-AUG-0612121'
      2  /
    select * from dt_test_date where dt='03-AUG-0612121'
    ERROR at line 1:
    ORA-01830: date format picture ends before converting entire input string
    SQL> select * from dt_test_date where dt=TO_DATE('03-AUG-06','DD-MON-YY')
      2  /
    no rows selectedThe second part of the problem is that the date column in your table will contain a time as well as the date:
    SQL> alter session set nls_date_format='DD-MON-YYYY HH24:MI:SS'
      2  /
    Session altered.
    SQL> select * from dt_test_date
      2  /
    DT
    03-AUG-2006 16:50:00
    04-AUG-2006 16:50:08Which means that you either have to specify the time portion, eliminate it from consideration using TRUNC, or set up a date range to search over that goes from 00:00:00 to 23:59:59 - the last is my prefered option:
    SQL> SELECT
      2     *
      3  FROM
      4     dt_test_date
      5  WHERE
      6     dt >= TO_DATE('03-AUG-2006 00:00:00','DD-MON-YYYY HH24:MI:SS')
      7  AND
      8     dt <= TO_DATE('03-AUG-2006 23:59:59','DD-MON-YYYY HH24:MI:SS')
      9  /
    DT
    03-AUG-2006 16:50:00Which means that because oracle automatically sets the time portion to midnight when it is not specified, you can simplify this to be:
    SQL> SELECT
      2     *
      3  FROM
      4     dt_test_date
      5  WHERE
      6     dt >= TO_DATE('03-AUG-2006','DD-MON-YYYY')
      7  AND
      8     dt < TO_DATE('03-AUG-2006','DD-MON-YYYY') + 1
      9  /
    DT
    03-AUG-2006 16:50:00
    SQL> SELECT
      2     dt,
      3     TO_DATE('03-AUG-2006','DD-MON-YYYY'),
      4     TO_DATE('03-AUG-2006','DD-MON-YYYY') + 1
      5  FROM
      6     dt_test_date
      7  WHERE
      8     dt >= TO_DATE('03-AUG-2006','DD-MON-YYYY')
      9  AND
    10     dt < TO_DATE('03-AUG-2006','DD-MON-YYYY') + 1
    11  /
    DT                   TO_DATE('03-AUG-2006 TO_DATE('03-AUG-2006
    03-AUG-2006 16:50:00 03-AUG-2006 00:00:00 04-AUG-2006 00:00:00
         HTH
    David

  • How can i cast array of string to int ?

                       while(st.hasMoreTokens()){
                                  test[count] = st.nextToken();
                                  count++;
                          }Since token deal with string, i have to pass them into String of array, but how can i convert all of them to int to perform arithmetic operation?

         public static void main (String[] args) throws IOException{
               DataInputStream dis = null;
                 String dbRecord = null;
                 int tokenCount = 0;
                 int numOfQuestion = 0;
                 int questionnAireNum = 0;
                 int postCode = 0;
                 int age = 0;
                 int gender = 0;
                 String [] response = new String[10];
                    File f = new File("polldata.txt");
                    FileInputStream fis = new FileInputStream(f); 
                    BufferedInputStream bis = new BufferedInputStream(fis); 
                    dis = new DataInputStream(bis);
                    // read the first record of the database
                    while ( (dbRecord = dis.readLine()) != null) {
                       StringTokenizer st = new StringTokenizer(dbRecord, ",");
                       tokenCount = st.countTokens();
                       numOfQuestion = tokenCount-4;
                       String rquestionNum = st.nextToken();
                       questionnAireNum = Integer.parseInt(rquestionNum);
                       String rpostCode = st.nextToken();
                       postCode = Integer.parseInt(rpostCode);
                       String rAge  = st.nextToken();
                       age = Integer.parseInt(rAge);
                       String rGender = st.nextToken();
                       gender = Integer.parseInt(rGender);
                       for(int i=0; i<numOfQuestion;i++){
                            response[i] = st.nextToken();
                       }hi how come when i cast the string as int it prompt me error as shown below ? I wonder what causes this because this is normally how i cast string to int, somehow it won work this way with token.
    Exception in thread "main" java.lang.NumberFormatException: For input string: " 3"
         at java.lang.NumberFormatException.forInputString(NumberFormatException.java:48)
         at java.lang.Integer.parseInt(Integer.java:447)
         at java.lang.Integer.valueOf(Integer.java:553)
         at test.main(test.java:43)

  • Whats wrong with this query.can anyone help me......

    select CASE WHEN TO_NUMBER(SUBSTR(TO_CHAR(START_TIME_TIMESTAMP,'DDMMYYYY HH24:MM:SS'),13,2))>0 AND TO_NUMBER(SUBSTR(TO_CHAR(START_TIME_TIMESTAMP,'YYYYMMDD HH24:MM:SS'),13,2)) <14
    THEN TO_DATE(CONCAT(SUBSTR(TO_CHAR(START_TIME_TIMESTAMP,'YYYYMMDD HH24:MM:SS'),13,2)||'00',SUBSTR(TO_CHAR(START_TIME_TIMESTAMP,'YYYYMMDD HH24:MI:SS'),16)||'00'),'DD-MM-YYYY HH24:MI:SS') end
    from table;
    i have written this query.whats wrong with this query..........
    the error is "literal does not match format string"
    Reegards soumen

    Why does your date_format loose, ununify and not fix ?
    And what is your exact requirement?
    >>
    CASE WHEN
    TO_NUMBER(SUBSTR(TO_CHAR(START_TIME_TIMESTAMP,'DDMMYYYY HH24:MM:SS'),13,2))>0
    AND TO_NUMBER(SUBSTR(TO_CHAR(START_TIME_TIMESTAMP,'YYYYMMDD HH24:MM:SS'),13,2)) <14
    <<
    This is
    CASE WHEN TO_CHAR(START_TIME_TIMESTAMP,'MM') between '01' and '13'
    >>
    THEN TO_DATE(CONCAT(SUBSTR(TO_CHAR(START_TIME_TIMESTAMP,'YYYYMMDD HH24:MM:SS'),13,2)
    ||'00',
    SUBSTR(TO_CHAR(START_TIME_TIMESTAMP,'YYYYMMDD HH24:MI:SS'),16)||'00'),
    'DD-MM-YYYY HH24:MI:SS')
    <<
    This is
    TO_DATE(
    TO_CHAR(START_TIME_TIMESTAMP,'MM"00"SS"00"),
    'DD-MM-YYYY HH24:MI:SS')
    Obviously, format is not matching !
    SQL> select to_char(sysdate,'MM"00"SS"00') from dual;
    TO_CHAR(
    06004900
    SQL> select to_date('06004900','DD-MM-YYYY HH24:MI:SS') from dual;
    select to_date('06004900','DD-MM-YYYY HH24:MI:SS') from dual
    ERROR at line 1:
    ORA-01861: literal does not match format string

  • Whats wrong with the sql query-- giving no rows selected

    i have a table audit_data with 4 columns , eff_m & end_m are declared as timestamp and the time stamp data is different for all the records
    Please advice as soon as possible as this is a production problem
    ORG_GRP_I grn_n ED_EFF_m (timestamp) ED_END_M OFV
    1 999 01-Jan-06 1 03-Aug-06 0 0
    1 999 28-Jul-06 0 04-Aug-06 1 0
    1 999 04-Aug-06 1 04-Aug-06 1 0
    1 999 04-Aug-06 0 6.08
    This query is giving no rows returned,even though there is data in database
    SELECT NVL(OFV,0)
    FROM audit_data ag
    WHERE ag.ORG_GRP_I = 1
    AND ag.GRN_N = 999
    AND (ag.ED_EFF_M,NVL(ag.ED_END_M,SYSDATE)) IN (SELECT MAX(ED_EFF_M),MAX(NVL(ED_END_M,SYSDATE))
    FROM audit_data ag2
    WHERE ag2.ORG_GRP_I= ag.org_grp_i
    AND ag2.grn_n=ag.grn_n
    AND To_Date(To_Char(ag2.ED_EFF_M,'MM/DD/YYYY'),'MM/DD/YYYY') <= TO_DATE(TO_CHAR('08/04/06','MM/DD/YYYY'),'MM/DD/YYYY')
    AND To_Date(To_Char(NVL(ag2.ED_END_M,SYSDATE),'MM/DD/YYYY'),'MM/DD/YYYY') >= TO_DATE(TO_CHAR('08/04/06','MM/DD/YYYY'),'MM/DD/YYYY'));
    This query is giving value 6.08, when made type conversions.
    what wrong with the above query.please advice
    SELECT NVL(OFV,0)
    FROM audit_data ag
    WHERE ag.ORG_GRP_I = 1
    AND ag.GRN_n = 999
    AND (to_date(to_char(ag.ED_EFF_M,'mm/dd/yyyy'),'mm/dd/yyyy'),NVL(to_date(to_char(ag.ED_END_M,'mm/dd/yyyy'),'mm/dd/yyyy'),SYSDATE)) IN
    (SELECT MAX(to_date(to_char(ED_EFF_M,'mm/dd/yyyy'),'mm/dd/yyyy')),MAX(NVL(ED_END_M,SYSDATE))
    FROM audit_data ag2
    WHERE ag2.ORG_GRP_I= ag.org_grp_i
    AND ag2.grn_n=ag.grn_n
    AND To_Date(To_Char(ag2.ED_EFF_M,'MM/DD/YYYY'),'MM/DD/YYYY') <= TO_date('08/04/2006','MM/DD/YYYY')
    AND To_Date(To_Char(NVL(ag2.ED_END_M,SYSDATE),'MM/DD/YYYY'),'MM/DD/YYYY') >= TO_DATE('08/04/2006','MM/DD/YYYY'));

    In the second query you convert a string to a date correctly using TO_DATE(string,date format)
    In the first query you try to make a char of something that already is a char, e.g. TO_CHAR('08/04/06','MM/DD/YYYY').
    The TO_CHAR functions expects either a number or a date as its first parameter. That's why it's giving you a ORA-01722.

  • Help Me With This Error I Don't Know What Wrong With It Please

    Whats wrong with my program every time I compile it it has an error saying that ')' expected I don't know whats wrong with it someone help me, thank you.
    //   Robins.java
    //   Demonstrate the different behaviors of the + operator
    public class Robins
        // main prints some expressions using the + operator
        public static void main (String[] args)
         System.out.println ("Ten robins plus " + 13 canaries is + 23 birds);
    }

    System.out.println ("Ten robins plus " + "13 canaries is" + "23 birds");You can't type regular text that is not inside of " and " or it will be treated as a number / variable / something else.

  • Whats wrong with this logic - Why the error, out of bounds

    Hi there,
    I have this code that I am trying to work out with some logic I have put together, as shown below, but I get an error message saying "Exception in thread "main" java.lang.StringIndexOutOfBoundsException: String index out of range: -29
    ":" What I am basically trying to do is print out a string which has both numbers and words into a vertical dialog window with the appropriate words next to their corresponding numbers.
    {code}
    A = "91011Word121314Sentence151617";
    int start = 9;
    int end = 17;
    // Considering that we are on the first iteration
    for(int i = start; i <= end; i++)
    String a2 = "" + i; // convert the integer 9 into a string
    int a1 = A.indexOf(a2); // get the index of 9 in the string A
    int a3 = a2.length(); // get the length of 9
    int a4 = a1 + a3; // the index of 9 plus its length is "equivalent" to the index of the next number in A -- 1
    String a5 = "" + (i+1); // convert the next integer 10 into a string
    int a6 = A.indexOf(a5); // get the index of 10 in the string A -- 1
    add += a2 + " " + A.substring(a4,a6) + "\n";
    /** Following the logic I would expect that at the end of the first iteration the String "add" should contain,
    just 9 followed by a space, and the A.substring(1,1) would return nothing since there is no word in the
    middle then there will be a new line */
    {code}
    However, I ended up getting a string index out of bounds exception. I would appreciate it if someone could explain to me why that would be so.
    Thanks

    define wrote:
    for(int i = start; i <= end; i++)
    That should probably be "i < end". This program seems very fragile btw. No checking if indexOf() return numbers less than zero, and ambiguous data..
    To improve your code, you should use better variable names. Also, it's better to use String.valueOf(i) instead of "" + i
    Edited by: paul.miner on Dec 7, 2007 8:53 PM - Typos

  • Need help understanding whats wrong with ASP checking for empty fields.

    Can anyone tell me whats wrong with these if statements: If i
    sumbit the
    form providing everything except the dream_inscript field it
    gives me this
    error:
    =================================================
    Microsoft OLE DB Provider for ODBC Drivers error '80040e57'
    [Microsoft][ODBC Microsoft Access Driver]Invalid string or
    buffer length
    /purch_confirm_mail.asp, line 67
    =================================================
    If i submit the form and provide just that field along with
    the first 4
    which are automatically passed from the DB the form submits
    fine and no
    problem.. I know it has something to do with my If
    Statements..
    Basically i want to check the 4 fields:
    dream_inscript If this one is -1 then pass N/A to the db
    dream_price If dream_inscript <> -1 then pass 45 to the
    db
    dream_comm if dream_comm is empty then pass N/A to the db
    custom_inscript if custom_inscript is empty then pass N/A to
    the db
    custom_wanted if this is Y then pass 45 to the db
    custom_comm if this is empty then pass N/A to the db
    MM_editCmd.CommandText = "INSERT INTO tbMailOrders
    (item_number,
    item_summary, item_price, shipping_cost, dream_price,
    dream_inscript,
    dream_comm, custom_comm, custom_price, video_wanted,
    video_price,
    grandtotal, cs_name, pp_email, c_email) VALUES (?, ?, ?, ?,
    MM_editCmd.Prepared = true
    MM_editCmd.Parameters.Append
    MM_editCmd.CreateParameter("param1", 202,
    1, 10, Request.Form("item_number")) ' adVarWChar
    MM_editCmd.Parameters.Append
    MM_editCmd.CreateParameter("param2", 202,
    1, 255, Request.Form("item_summary")) ' adVarWChar
    MM_editCmd.Parameters.Append
    MM_editCmd.CreateParameter("param3", 202,
    1, 10, Request.Form("itemprice")) ' adVarWChar
    MM_editCmd.Parameters.Append
    MM_editCmd.CreateParameter("param4", 202,
    1, 10, Request.Form("shippingcost")) ' adVarWChar
    If cStr(Request.Form("dream_inscript"))<> "-1" Then
    MM_editCmd.Parameters.Append
    MM_editCmd.CreateParameter("param5", 202, 1,
    10, "45") ' adVarWChar
    Else
    MM_editCmd.Parameters.Append
    MM_editCmd.CreateParameter("param5", 202,
    1, 10, "0.00") ' adVarWChar
    End If
    If cStr(Request.Form("dream_inscript"))<> "-1" Then
    MM_editCmd.Parameters.Append
    MM_editCmd.CreateParameter("param6", 203, 1,
    1073741823, Request.Form("dream_inscript")) ' adLongVarWChar
    Else
    MM_editCmd.Parameters.Append
    MM_editCmd.CreateParameter("param6", 203,
    1, 1073741823, "N/A") ' adLongVarWChar
    End If
    If Len(cStr(Request.Form("dream_comm")))= "0" Then
    MM_editCmd.Parameters.Append
    MM_editCmd.CreateParameter("param7", 203,
    1, 1073741823, "N/A") ' adLongVarWChar
    Else
    MM_editCmd.Parameters.Append
    MM_editCmd.CreateParameter("param7", 203,
    1, 1073741823, Request.Form("dream_comm")) ' adLongVarWChar
    End If
    If Len(cStr(Request.Form("custom_inscript")))= "0" Then
    MM_editCmd.Parameters.Append
    MM_editCmd.CreateParameter("param8", 203,
    1, 1073741823, "N/A") ' adLongVarWChar
    Else
    MM_editCmd.Parameters.Append
    MM_editCmd.CreateParameter("param8", 203, 1,
    1073741823, Request.Form("custom_inscript")) ' adLongVarWChar
    End If
    If Request.Form("custom_wanted")= "Y" Then
    MM_editCmd.Parameters.Append
    MM_editCmd.CreateParameter("param9", 202,
    1, 10, "45") ' adVarWChar
    Else
    MM_editCmd.Parameters.Append
    MM_editCmd.CreateParameter("param9", 202,
    1, 10, "0.00") ' adVarWChar
    End If
    If Request.Form("video_wanted")= "Y" Then
    MM_editCmd.Parameters.Append
    MM_editCmd.CreateParameter("param10", 202,
    1, 10, "Yes") ' adVarWChar
    Else
    MM_editCmd.Parameters.Append
    MM_editCmd.CreateParameter("param10", 202,
    1, 10, "No") ' adVarWChar
    End If
    If Request.Form("video_wanted")= "Y" Then
    MM_editCmd.Parameters.Append
    MM_editCmd.CreateParameter("param11", 202, 1,
    10, "15") ' adVarWChar
    Else
    MM_editCmd.Parameters.Append
    MM_editCmd.CreateParameter("param11", 202,
    1, 10, 0.00) ' adVarWChar
    End If
    MM_editCmd.Parameters.Append
    MM_editCmd.CreateParameter("param12", 202,
    1, 10, Request.Form("grand")) ' adVarWChar
    MM_editCmd.Parameters.Append
    MM_editCmd.CreateParameter("param13", 202,
    1, 255, Request.Form("name")) ' adVarWChar
    MM_editCmd.Parameters.Append
    MM_editCmd.CreateParameter("param14", 202,
    1, 255, Request.Form("email")) ' adVarWChar
    MM_editCmd.Parameters.Append
    MM_editCmd.CreateParameter("param15", 202,
    1, 255, Request.Form("email2")) ' adVarWChar
    MM_editCmd.Execute
    MM_editCmd.ActiveConnection.Close
    ASP, SQL2005, DW8 VBScript, Access

    issue corrected.
    ASP, SQL2005, DW8 VBScript, Visual Studio 2005, Visual Studio
    2008
    "Daniel" <[email protected]> wrote in message
    news:[email protected]...
    > Can anyone tell me whats wrong with these if statements:
    If i sumbit the
    > form providing everything except the dream_inscript
    field it gives me this
    > error:
    > =================================================
    > Microsoft OLE DB Provider for ODBC Drivers error
    '80040e57'
    > [Microsoft][ODBC Microsoft Access Driver]Invalid string
    or buffer length
    >
    > /purch_confirm_mail.asp, line 67
    > =================================================
    > If i submit the form and provide just that field along
    with the first 4
    > which are automatically passed from the DB the form
    submits fine and no
    > problem.. I know it has something to do with my If
    Statements..
    >
    > Basically i want to check the 4 fields:
    >
    > dream_inscript If this one is -1 then pass N/A to the db
    > dream_price If dream_inscript <> -1 then pass 45
    to the db
    > dream_comm if dream_comm is empty then pass N/A to the
    db
    >
    > custom_inscript if custom_inscript is empty then pass
    N/A to the db
    > custom_wanted if this is Y then pass 45 to the db
    > custom_comm if this is empty then pass N/A to the db
    >
    >
    >
    >
    > MM_editCmd.CommandText = "INSERT INTO tbMailOrders
    (item_number,
    > item_summary, item_price, shipping_cost, dream_price,
    dream_inscript,
    > dream_comm, custom_comm, custom_price, video_wanted,
    video_price,
    > grandtotal, cs_name, pp_email, c_email) VALUES (?, ?, ?,
    > ?, ?, ?, ?, ?, ?)"
    > MM_editCmd.Prepared = true
    > MM_editCmd.Parameters.Append
    MM_editCmd.CreateParameter("param1", 202,
    > 1, 10, Request.Form("item_number")) ' adVarWChar
    > MM_editCmd.Parameters.Append
    MM_editCmd.CreateParameter("param2", 202,
    > 1, 255, Request.Form("item_summary")) ' adVarWChar
    > MM_editCmd.Parameters.Append
    MM_editCmd.CreateParameter("param3", 202,
    > 1, 10, Request.Form("itemprice")) ' adVarWChar
    > MM_editCmd.Parameters.Append
    MM_editCmd.CreateParameter("param4", 202,
    > 1, 10, Request.Form("shippingcost")) ' adVarWChar
    > If cStr(Request.Form("dream_inscript"))<> "-1"
    Then
    > MM_editCmd.Parameters.Append
    MM_editCmd.CreateParameter("param5", 202, 1,
    > 10, "45") ' adVarWChar
    > Else
    > MM_editCmd.Parameters.Append
    MM_editCmd.CreateParameter("param5", 202,
    > 1, 10, "0.00") ' adVarWChar
    > End If
    > If cStr(Request.Form("dream_inscript"))<> "-1"
    Then
    > MM_editCmd.Parameters.Append
    MM_editCmd.CreateParameter("param6", 203, 1,
    > 1073741823, Request.Form("dream_inscript")) '
    adLongVarWChar
    > Else
    > MM_editCmd.Parameters.Append
    MM_editCmd.CreateParameter("param6", 203,
    > 1, 1073741823, "N/A") ' adLongVarWChar
    > End If
    > If Len(cStr(Request.Form("dream_comm")))= "0" Then
    > MM_editCmd.Parameters.Append
    MM_editCmd.CreateParameter("param7", 203,
    > 1, 1073741823, "N/A") ' adLongVarWChar
    > Else
    > MM_editCmd.Parameters.Append
    MM_editCmd.CreateParameter("param7", 203,
    > 1, 1073741823, Request.Form("dream_comm")) '
    adLongVarWChar
    > End If
    > If Len(cStr(Request.Form("custom_inscript")))= "0" Then
    > MM_editCmd.Parameters.Append
    MM_editCmd.CreateParameter("param8", 203,
    > 1, 1073741823, "N/A") ' adLongVarWChar
    > Else
    > MM_editCmd.Parameters.Append
    MM_editCmd.CreateParameter("param8", 203, 1,
    > 1073741823, Request.Form("custom_inscript")) '
    adLongVarWChar
    > End If
    > If Request.Form("custom_wanted")= "Y" Then
    > MM_editCmd.Parameters.Append
    MM_editCmd.CreateParameter("param9", 202,
    > 1, 10, "45") ' adVarWChar
    > Else
    > MM_editCmd.Parameters.Append
    MM_editCmd.CreateParameter("param9", 202,
    > 1, 10, "0.00") ' adVarWChar
    > End If
    > If Request.Form("video_wanted")= "Y" Then
    > MM_editCmd.Parameters.Append
    MM_editCmd.CreateParameter("param10", 202,
    > 1, 10, "Yes") ' adVarWChar
    > Else
    > MM_editCmd.Parameters.Append
    MM_editCmd.CreateParameter("param10", 202,
    > 1, 10, "No") ' adVarWChar
    > End If
    > If Request.Form("video_wanted")= "Y" Then
    > MM_editCmd.Parameters.Append
    MM_editCmd.CreateParameter("param11", 202, 1,
    > 10, "15") ' adVarWChar
    > Else
    > MM_editCmd.Parameters.Append
    MM_editCmd.CreateParameter("param11", 202,
    > 1, 10, 0.00) ' adVarWChar
    > End If
    > MM_editCmd.Parameters.Append
    MM_editCmd.CreateParameter("param12", 202,
    > 1, 10, Request.Form("grand")) ' adVarWChar
    > MM_editCmd.Parameters.Append
    MM_editCmd.CreateParameter("param13", 202,
    > 1, 255, Request.Form("name")) ' adVarWChar
    > MM_editCmd.Parameters.Append
    MM_editCmd.CreateParameter("param14", 202,
    > 1, 255, Request.Form("email")) ' adVarWChar
    > MM_editCmd.Parameters.Append
    MM_editCmd.CreateParameter("param15", 202,
    > 1, 255, Request.Form("email2")) ' adVarWChar
    > MM_editCmd.Execute
    > MM_editCmd.ActiveConnection.Close
    >
    > --
    > ************************************************
    > ASP, SQL2005, DW8 VBScript, Access
    >

Maybe you are looking for