iterate through datagrid row wise and insert new records into access database using vb.net2003

db , vb.net Korea
  • 12 years ago

    I need to import excel records into access database using vb.net 2003.i’m successful in retrieving records from excel to datagrid.
    The datagrid may have 1000 records with 10 columns.I need to iterate through each row of datagrid to find whether this record is
    Already exist in access database 2003.i have given 3 fields combination as primary key in database.if record already exists in
    Database it should ignore that row and check for next record of datagrid.i need ur valuable suggestion regarding how to proceed
    Or any sample codes wil help me a lot.awaiting for ur replies as early as possible…..

    Thanking you in advance.
    Regards
    Chandru

  • 12 years ago

    If you initiated dg with some datatable, you rather use that datatable / datasource for iteration. You may get values in string()() array, then create y-dimensional copy of integer array, then use check exist (Select Count(*) Where ...) for all rows of source array, results put in that integer array, and then make one more cycle and prepare and execute inserts from String(y) for Integer(y)=0.

  • 12 years ago

     Hi Konikula, I'm using datatable as datasource to import into datagrid.can u pls share source code for inserting the records from this datagrid to access database.bcoz i'm stuck somewhere in the loop to iterate through the records, as i also need to check for existence of records in database.

    thanks in advance..

    regards

    chandru

     

     

Post a reply

Enter your message below

Sign in or Join us (it's free).

Contribute

Why not write for us? Or you could submit an event or a user group in your area. Alternatively just tell us what you think!

Our tools

We've got automatic conversion tools to convert C# to VB.NET, VB.NET to C#. Also you can compress javascript and compress css and generate sql connection strings.

“If Java had true garbage collection, most programs would delete themselves upon execution.” - Robert Sewell