here is my bean code i want that when user user submit the form all data
should be inserted and the id which is autonumber wiil be displayed to user.

my database is like this

id -------autoincriment
name-----text
age --------number
date ---------date/time

all going right
but when the save method is called the exception ArryOutOfBoundException is
generated why ???????
please help

my bean is like this

import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import java.sql.*;

public class Bean1 extends JFrame {
    Connection con;
    Statement stat;
    ResultSet rs;
    String Name;
    int age;
    java.sql.Date date;

    public Bean1() {
        try {
            Class.forName("sun.jdbc.odbc.JdbcOdbcDriver") ;
            con = DriverManager.getConnection("jdbc:odbc:data","","") ;
            stat =
con.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE,ResultSet.CONCUR_UPDATAB
LE) ;

            rs = stat.executeQuery("select * from data");
            rs.beforeFirst() ;
        }
        catch(Exception e) {
            e.printStackTrace();
        }
    }
    public new(){
          this.rs.moveToInsertRow();
    }
    public save(){
            rs.updateString("Name",this.Name ) ;
            rs.updateInt("Age",age ) ;
            rs.updateString("Date",date) ;
            this.rs.insertRow() ;
    }

}



the exception is

java.lang.ArrayIndexOutOfBoundsException
 at sun.jdbc.odbc.JdbcOdbcResultSet.bindCol(JdbcOdbcResultSet.java:4485)
 at sun.jdbc.odbc.JdbcOdbcResultSet.insertRow(JdbcOdbcResultSet.java:3941)

===========================================================================
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST".
For digest: mailto [EMAIL PROTECTED] with body: "set JSP-INTEREST DIGEST".
Some relevant FAQs on JSP/Servlets can be found at:

 http://java.sun.com/products/jsp/faq.html
 http://www.esperanto.org.nz/jsp/jspfaq.html
 http://www.jguru.com/jguru/faq/faqpage.jsp?name=JSP
 http://www.jguru.com/jguru/faq/faqpage.jsp?name=Servlets

Reply via email to