Results 1 to 8 of 8
  1. #1
    gauravmanral's Avatar
    gauravmanral is offline Gaurav Manral
    Join Date
    Jul 2011
    Location
    Delhi
    Posts
    37
    Rep Power
    0

    Question Updating Ms Access Database using jsp

    I am updating my MS Access database using JSP.

    I am getting this exception...

    java.sql.SQLException: [Microsoft][ODBC Microsoft Access Driver] Syntax error in UPDATE statement.

    table name is "user_registration".
    My code is--

    ResultSet rs;
    rs = st1.executeQuery("select * from user_registration where username='" + s1 + "' and password='" + s2 + "'");


    while(rs.next())
    {
    PreparedStatement ps=null;

    ps=con.prepareStatement("update user_registration set values(?,?,?,?,?,?,?,?,?,?,?,?,?) where username=?");

    ps.setString(14,username);
    ps.setString(1,firstname);
    ps.setString(2,lastname);
    ps.setString(3,username);
    ps.setString(4,password);
    ps.setString(5,confirm);
    ps.setString(6,date);
    ps.setString(7,month);
    ps.setString(8,year);
    ps.setString(9,gender);
    ps.setString(10,mobile);
    ps.setString(11,email);
    ps.setString(12,image);
    ps.setString(13,"u");

    if(ps!=null)
    {
    ps.executeUpdate();
    }
    else
    {
    ps.close();
    }

    if(con==null)
    {
    con.close();
    }

    }





    Please Help..!!

  2. #2
    DarrylBurke's Avatar
    DarrylBurke is offline Member
    Join Date
    Sep 2008
    Location
    Madgaon, Goa, India
    Posts
    11,184
    Rep Power
    19

    Default Re: Updating Ms Access Database using jsp

    If you're forever cleaning cobwebs, it's time to get rid of the spiders.

  3. #3
    Tolls is offline Moderator
    Join Date
    Apr 2009
    Posts
    11,863
    Rep Power
    19

    Default Re: Updating Ms Access Database using jsp

    Please use [code] tags [/code] when posting code. See the link provided by Darryl.
    What do the Access docs say about the structure of an UPDATE statement?
    Are you sure your fields are all Strings (VARCHAR or whatever they're called in Access) in the database?
    Please do not ask for code as refusal often offends.

    ** This space for rent **

  4. #4
    gauravmanral's Avatar
    gauravmanral is offline Gaurav Manral
    Join Date
    Jul 2011
    Location
    Delhi
    Posts
    37
    Rep Power
    0

    Post Re: Updating Ms Access Database using jsp

    I have checked, All fields are strings.

  5. #5
    gauravmanral's Avatar
    gauravmanral is offline Gaurav Manral
    Join Date
    Jul 2011
    Location
    Delhi
    Posts
    37
    Rep Power
    0

    Default Re: Updating Ms Access Database using jsp

    thanks Darryl....I will mind this now..

  6. #6
    Tolls is offline Moderator
    Join Date
    Apr 2009
    Posts
    11,863
    Rep Power
    19

    Default Re: Updating Ms Access Database using jsp

    Run that update directly in Access, with the values you are having problems with.
    Please do not ask for code as refusal often offends.

    ** This space for rent **

  7. #7
    gauravmanral's Avatar
    gauravmanral is offline Gaurav Manral
    Join Date
    Jul 2011
    Location
    Delhi
    Posts
    37
    Rep Power
    0

    Default Re: Updating Ms Access Database using jsp

    now this exception is occured...


    java.sql.SQLException: [Microsoft][ODBC Microsoft Access Driver] Syntax error in UPDATE statement.

  8. #8
    Tolls is offline Moderator
    Join Date
    Apr 2009
    Posts
    11,863
    Rep Power
    19

    Default Re: Updating Ms Access Database using jsp

    Which is the same as the other exception.
    All that means is there is a problem in your update SQL.
    Not really a Java problem to be honest.
    Please do not ask for code as refusal often offends.

    ** This space for rent **

Similar Threads

  1. Problem updating access database from jsp
    By Penhexy in forum JavaServer Pages (JSP) and JSTL
    Replies: 1
    Last Post: 03-17-2011, 08:50 AM
  2. Replies: 2
    Last Post: 02-11-2009, 04:43 AM
  3. Updating database table from JTable
    By yesjava in forum New To Java
    Replies: 1
    Last Post: 08-16-2008, 10:16 PM
  4. Help needed with updating mysql database
    By SilentCodingOne in forum New To Java
    Replies: 1
    Last Post: 12-11-2007, 10:23 PM
  5. Replies: 1
    Last Post: 08-07-2007, 07:51 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •