DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 2 of 2
  1. #1
    haish Guest

    Insert values to an access database

    I am trying to read 1000 line items from a file and put them into a Access
    Database. Each line item is a seperate column. whats the best way to do this?

    The way I know to insert a record to a table is by using
    INSERT INTO PersonData2 VALUES (value1, value2, value3)
    If I use that I a think I have to declare 1000 variables.

    Is there a better way to do this. Please let me know if there is one.

  2. #2
    MarkN Guest

    Re: Insert values to an access database

    1000 items in one table? I think some thing is wrong if so.

    It all depends on how things are set up. If the 'columns' in the file exactly
    match the columns in the database then just loop and build the insert statement.

    Here is some quickly hacked out code. You will need to define the methods
    to read next column (or do what you need) and delimit (ie 'fred') and escape
    (ie 'Joe''s Bar and Grill').

    StringBuffer insertStmt = new StringBuffer("INSERT INTO PersonData2 VALUES
    for (int i = 0; i < 1000; i++)
    if(i > 0)


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
HTML5 Development Center
Latest Articles
Questions? Contact us.
Web Development
Latest Tips
Open Source

   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center

We have made updates to our Privacy Policy to reflect the implementation of the General Data Protection Regulation.