Read and Edit MS Excel file and store the EXcel file Data to Access Database using C#.Net Part 2

MS Office development with C# and visual studio .net.
This video shows how we can interact with MS Excel file using C# and Visual Studio.Net. The video shows how to read the content from an excel file and then edit and store those contents in MS Access Data Base

15 thoughts on “Read and Edit MS Excel file and store the EXcel file Data to Access Database using C#.Net Part 2

  1. Hello Sir, thank you so much for the videos. I am currently working on a very important project. May I ask if any of the good programmers can help me with it? It's actually using Visual C# to read an Excel/Word file populate into the Outlook calendar and the professors view the calendar using their mobile device. Will appreciate if any of y'all are able to help/guide me. Thank you. My email is

  2. @Kashif Bilal Great videos and I really appreciate your material! 🙂 I am however, having a problem with the export button, I have followed all steps and typed all the code and I am getting no errors, however my database is not being updated…

  3. This query
    select Address, Number from TableName where LastName is NULL;

    will return you only those records that have LastName empty.
    If you want even more simple solution,
    Use this piece of code (change the tableand field names)

    string query = "select * from TableName";

    OledbCommand cmd = new OedbComand(connection,query);

    OledbDataReaDER RD = CMD.eXECUTErEADER();

    while (rd.Read())
    Inserrt query for adding Addres and NUmber other table

  4. How do i create the check if its NULL?
    im having troubles with the code.
    Im suppose to read the whole datarow and where its NULL insert the values in new table.

  5. Well,

    It seems fairly simple.
    Although it can be done with a complex query, I will try to demonstrate it in a by involving programming in it.

    Select all the record with empty last name ..
    You may check

    select Address, Number from TableName where LastName is NULL

    Then use an OledbDataReader to read all recored , and use insert statemnt within the while (Reader.Read()) loop to insert the values in new table.

  6. Dear Kashif.
    Great video. I learnt alot with it.
    I need your help here… I am trying to make a loop which check's only the LastName row and check's the values of it. If it has a value its ok. If the value is empty I want to write the value of the Address and the Number in the Access table.
    Can you help me out with the code? Please…

  7. Hi!

    Do you mean that if arrangement of the columns in the table is different from arrangement of columns in excel file.
    Well, the most simple way to make the process dynamic and flexible, create a table dynamically using CREATE TABLE query (instead of creating i manually as I did to make the video and process simple).
    When you create table from the information you have in dataset of excel file, then arrangment and number of columns in the table would be similar.

  8. Hi Kashif,

    What kind of Code/loop would I use in order to automate the process so I don't have to include the "dr[x] = r[x]" each time I include a new column into my excel spreadsheet?

    Also, is there a reason why the data from Excel is not populating into the Access Database? I have Access 2013.

Leave a Reply

Your email address will not be published. Required fields are marked *