How can I achieve this ? RRS feed

  • Question

  • Hi ,

    We have a requirement of loading the master data  from excel sheets to sql database. The master can be different for each products .So we are thinking to build an utility that can be useful to work with all the products.

    Please let me know the best way to build it ?


    Monday, June 25, 2018 1:09 PM

All replies

  • If the data in the master is different then mapping would be needed to map the Excel data to the database table columns.

    The logic for the following interface is not simple but provides a view of what a utility would present to someone that knows the data. In this case I had this form side by side with another form showing data in a DataGridView to assist the user to map columns.

    Once columns where mapped code would do assertion on data types for each column and validate e.g. if a column should be date then all rows for that column were validated to confirm they were dates.

    The actual push to SQL-Server can be done with SqlBulkCopy class and map via SqlBulkCopyColumnMapping.

    Please remember to mark the replies as answers if they help and unmark them if they provide no help, this will help others who are looking for solutions to the same or similar problem. Contact via my Twitter (Karen Payne) or Facebook (Karen Payne) via my MSDN profile but will not answer coding question on either.
    VB Forums - moderator
    profile for Karen Payne on Stack Exchange, a network of free, community-driven Q&A sites

    Monday, June 25, 2018 2:02 PM