Can not Insert data to Microsoft Access successfully

I am using Microsoft Access database, and trying to insert some data into a table with a "while" loop, but every time, the last row can not be inserted although the return value of the "executeUpdate()" is 1, can anyone tell what's wrong with that? thank you very much

http://forums.java.sun.com/thread.jsp?forum=48&thread=147704
Sounds like it may be the same "glitch"
Jamie

Similar Messages

  • Can not insert data to MS Access

    Hi All,
    I have create a table by manual in Access , in which I defined souch fields:
    SORTCODE(text type),FOODNAME(text type)..., and then I use follow statement to insert value :
    private DefaultTableModel model = new DefaultTableModel();
    Vector collectData = new Vector(50,20);
    String sqlStatement = "INSERT ������(SORTCODE,FOODNAME,MEASUREUNIT,QUANTITY,UNITPRICE,BUYDATE,SUPPLIER,BUYER,HOTELNUM,HOTELNAME,REMARK) VALUES (?,?,?,?,?,?,?,?,?,?,?)";
    try
    PreparedStatement insertData = dbConnection.prepareStatement(sqlStatement);
    for(int i=0;i<rowsFlag;i++)
    for(int j=1;j<cols;j++)
    collectData.add(model.getValueAt(i,j));
    insertData.setString(1,collectData.get(0).toString());
    int update = insertData.executeUpdate(); //an Exception throwed
    catch(Exception ex)
    ex.printStackTrace();
    when run the code , it always reports Access field not correct error , how to solve the problem ?

    Hi Liwei,
    Apart from what marych said, according to the code you posted, you are only supplying one value to your "PreparedStatement", namely:
    insertData.setString(1,collectData.get(0).toString());You need to supply eleven values (in total), since your "sqlStatement" contains eleven question-mark ("?") characters.
    Also note that if one of the values you supply is null, then you need to use the "setNull()" method (of "PreparedStatement") and not the "setString()" method.
    Hope this helps.
    Good Luck,
    Avi.

  • How to insert date in microsoft access

    dears
    i want to insert date in a table which is in microsoft access.
    and also use the date in where clause.
    the col. name is mydate and the data type is Date/Time
    when i try to insert the date as a string it cannot.
    '"+date.getText().trim()+"'
    what can i do plz help me.

    Right, use java.sql.PreparedStatement and its setDate()/setTimestamp() methods. It'll escape the java.sql.Date and java.sql.Timestamp properly for you. I use PreparedStatement all the time to escape dates, times, and strings correctly in a portable way.

  • Can not insert Data

    Hi all ;
    when tryiing to call a stored procedure from java session bean ,i am getting this error message:
    [BEA][Oracle JDBC Driver][Oracle]ORA-20000: Records are not inserted into the stagging table
    ORA-06512: at "APPS3_MTNAOL.MTN_INV_MANAGER", line 2529
    ORA-06512: at line 1
    but when i am calling the same stored procedure from sql developper for test ,with the same input data, it is working fine. what can be the issue?

    ORA-20000 is a user-defined Error in the database. Please check with whoever developed the code within your organization on what that means.
    but when i am calling the same stored procedure from sql developper for test ,with the same input data, it is working fine. what can be the issue?Obviously, you are not able to recreate the error from 'sql developer'.
    Edited by: RPuttagunta on Dec 7, 2010 3:06 PM

  • How can I edit data in Microsoft access using ActiveX

    I've tried to modify Read Access DB with ActiveX to edit an entry in my database, but I get the following error
    Exception occured in DAO.Field, Update or CancelUpdate without AddNew or Edit..

    Did you try to do the same thing in LabVIEW (the same order, after you have the right reference to the recordset). I know this kind of problem from VB too. I didn't try it in LV but I supposed it should be the same.
    Let me know if it doesn't work.

  • Can not insert/update data from table which is created from view

    Hi all
    I'm using Oracle database 11g
    I've created table from view as the following command:
    Create table table_new as select * from View_Old
    I can insert/update data into table_new by command line.
    But I can not Insert/update data of table_new by SI Oject Browser tool or Oracle SQL Developer tool .(read only)
    Anybody tell me, what's happend? cause?
    Thankyou
    thiensu
    Edited by: user8248216 on May 5, 2011 8:54 PM
    Edited by: user8248216 on May 5, 2011 8:55 PM

    I can insert/update data into table_new by command line.
    But I can not Insert/update data of table_new by SI Oject Browser tool or Oracle SQL Developer tool .(read only)so what is wrong with the GUI tools & why posting to DATABASE forum when that works OK?

  • Insert Time and Date into Microsoft Access from Lookout

    I have an SQLExec running to export data to Microsoft Access - I would like to get A) A time stamp also to insert and B) A time stamp with out / and : -- I have found it impossible (from my limited knowledge) to do any of these things.
    Dose anyone have a very basic SQL Statement that might guide me on my way?
    Thanks!

    Oracle stores date and time in a DATE column; it all depends on how you have your insert statement. The last insert I specified the date and time
    ex.
    insert into test_date values(1,sysdate);
    insert into test_date values(2,sysdate-10.9);
    insert into test_date values(3,sysdate-8.098 );
    insert into test_date values(4,sysdate-5.11 );
    insert into test_date values(5, trunc(sysdate));
    INSERT into test_date values(6, to_date('01-JAN-2004 19:30', 'DD-MON-YYYY HH24:MI') );
    select * from test_date ;
    ID DDATE
      1 25-FEB-04
      3 17-FEB-04
      4 20-FEB-04
      5 25-FEB-04
      2 14-FEB-04
      6 01-JAN-04I don't see the time because the NLS_DATE_FORMAT is set to DD-MON-YY, but if I
    Select id, to_char( ddate , 'DD-MON-YYYY HH24:MI:SS AM') from test_date;
    ID TO_CHAR(DDATE,'DD-MO
    1 25-FEB-2004 06:57:02
    3 17-FEB-2004 04:37:05
    4 20-FEB-2004 04:20:02
    5 25-FEB-2004 00:00:00
    2 14-FEB-2004 09:24:50
    6 01-JAN-2004 19:30:00

  • I can insert data into an access database, but I need to querry the database for specific information. How do I do it?

    I can insert data into an access database, now I need to do some simple querries such as selecting all records that are greater than a certain value or = a certain value. How can I return only the selected records?

    If you don't want to spend any money, then instead of ActiveX, I would recomend LabSQL from Jeffrey Travis. I use it instead of the Connectivity toolkit and have had no problems. Besides being free, you have the advantage of being able to use it with any database. ActiveX ties you to Access and you upgrade your version of Access and find the properties and methods are different, you've got a lot of reprogramming to do.

  • HOW TO FILTER DATA FROM MICROSOFT ACCESS

    HOW TO FILTER DATA FROM MICROSOFT ACCESS BASED ON DATE AND TIME AND GIVE THE RESULT TO A TABLE ?
    I need some example files , can anybody please help me ?
    Solved!
    Go to Solution.

    Just be sure to get examples specific to the Jet DBMS. It is rather "idiosyncratic" when dealing with time and date values.
    One question: the timestamp is being saved in a datetime field, right?
    Mike...
    Certified Professional Instructor
    Certified LabVIEW Architect
    LabVIEW Champion
    "... after all, He's not a tame lion..."
    Be thinking ahead and mark your dance card for NI Week 2015 now: TS 6139 - Object Oriented First Steps

  • Can we insert data directly in standard table

    hi
    how can we insert data in standard table directly.
    pls reply urgently.

    Hi sapna yes u can insert data to the SAP tables, as shown below...
    use the table mara in the place of m
    REPORT  ZTEST_INSERT.
    TABLES: <m>.
    DATA: wa_m TYPE <m>.
    wa_m-ernam = 'ZTEST'.
    insert into <m> VALUES wa_m.
    if sy-subrc = 0.
      WRITE / 'Records inserted Successfully'.
    ENDIF.
    reward if usefull,
    Vishnu. R
    Edited by: vishnu ramanathan on Sep 18, 2008 2:17 PM

  • Can not extract data into BW from SQL SERVER

    Dear All,
      I meet a problem to extract data from database(MS SQL Server 2000(sp3)) into BW now and can not extract data into BW ODS, even PSA, In the monitor, display yellow light(0 from 0 record), detail message just display message "data request arranged" "confirmed with: confirmation" in requests(message) step; "missing message: request received" in extract (message)  step; "no data" in processing(data packet) step and so on. but in fact, there are two records in my database test table and DB connection is OK. Even I can extract data from another test oracle database into BW ODS successfully.
       Our BW system has two BW applicaton server and use oracle database. the one application server locates on IBM AIX host. the another one locates on one NT server. the application server on NT server is used for data extration from MS SQL SERVER  database into BW oracle database. and MS SQL SERVER and NT platform application server locate on same one host. DBSL was installed on the NT application server already. and DB connector also was created successfully for MS SQL SERVER and datasource also was generated. DBSL type is Kernel640-WIN-IA32bit-unicode. my BW system is ECC5.0/UNICODE/ORACLE. all table/view/field name of MS SQL server is upcase and have not any specific character. for example: ZDEMO etc.
    wait your help.
    Thanks in advance.
    Billy

    Hi  Ravi,
    Could you help me to get knowledge about the followings:
    approximately how many records    extracting and transfering  from SAP R/3 to BIW  in an organisation. for that how much time  will take .
    How to extract data from  two are three source system  to BIW. Kindly help me with step by step explanation .If any screen shots with documents pls fwd to my ID. "[email protected]"
    Your help highly appreciated.
    Thanks.
    Hema

  • Can not insert null into foreign key issue

    Hi ,
    I am having parent-child relationship table.
    In the child table when I am adding a new record , data is getting inserted with foreign key.
    After insert if I immediately update the same record. Its giving error that can not insert null into foreign key.
    If i click on rollback button I am able to update that record properly.

    Hi ,
    I am having parent-child relationship table.
    In the child table when I am adding a new record , data is getting inserted with foreign key.
    After insert if I immediately update the same record. Its giving error that can not insert null into foreign key.
    If i click on rollback button I am able to update that record properly.

  • I installed a version of Firefox 6.0. in the Russian program, the social network for sending a short message, I can not insert a file in the message field.

    I installed a version of 6.0. In the Russian program of social network My World by sending a short message, I can not insert a file in the message or photo. How do I solve this key problems?

    I need to access Network Solutions website builder too. It isn't compatible with Internet Explorer v9, Chrome v13, or Firefox v5! I believe Firefox v6 is out now. This is a Network Solution's problem. What's involved in rolling back? Can you still get add-ons, plugins, and extensions for such an older version? You can't save your personal preferences can you?

  • How to insert date into ms access database using sql query in servlet

    sir all thing is working well now only tell me how we can insert date into ms access database which is input by user .
    insert into db2(bookname,studentname,date) values('"+bname+"','"+sname+"',date_format)";{code}
    or either the system date is inserted with query .
      plz help me
    thanx                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           

    bhavishya wrote:
    sir all thing is working well now only tell me how we can insert date into ms access database which is input by user .
    insert into db2(bookname,studentname,date) values('"+bname+"','"+sname+"',date_format)";{code}
    or either the system date is inserted with query .
    plz help me
    thanxAnd that SQL statement is another reason to use PreparedStatement. I assume bname and sname are input from some form? Well, if that's the case, simply inserting them into SQL by simple String concatenation is just begging for all sorts of problems. What if there is an apostrophe in the entry? Broken Statement. Worse, it's a wide open invitation to an SQL Injection attack.

  • BDC not inserting data in mandatory fields of MM01

    Suddenly My BDC for sales maintenance View is not working as it is not inserting data in Mandatory fields.?can any one tell me the reason

    Hi Satyanarayan,
    1. Check ur code in debug to see if your internal table contains value in mandatory fields
    2. Try executing BDC program online to figure out the problem....
    3. Check ur code to see whether u r assigning values to this fields...
    Let me know if these things are ok in ur code...
    Enjoy SAP.

Maybe you are looking for

  • Properties toolbar not responding

    I am running Windows 7. I have a copy of Acrobat Pro 9 on my machine, as well as Reader X, with the latest updates. I only noticed this recently, but in Reader X, the Properties Toolbar isn't responding to anything...like if I select a highlight (tex

  • Date and time often wrong

    My passport date and time randomly revert, about once a week, to show the wrong values. The date always changes to 9 march 2015, and the time to some random no. This all happens independent of whether I have auto date/time update set to on or off. Th

  • No JobServers are configured for ISJobServerGroup. (COR-10715)

    hello, I have problem when do data profiling in Information steward: No JobServers are configured for ISJobServerGroup. (COR-10715) com.bobj.mm.sdk.SDKException: No JobServers are configured for ISJobServerGroup. (COR-10715) i search in the forums, m

  • Outlook 2011 Crashes

    I am trying to permanently delete deleted emails from Outlook 2011, but even just trying to delete one will make outlook crash. Any ideas how to fix this? They are locally stored deleted messages. I have like 9,000 of them. Dave

  • JTextpane positioning repaint problems

    Hello all, I have encountered a bug with JTextpane which I haven't found a solution for. I am new to Java and am revising previously written code, but I think this is a Java-related issue and not particular to my source code. I am writing html into a