HOW TO IMPORT EXCEL DATA TO DATABASE USING AJAX AND CLOSEDXML LIBRARY IN MVC C#

Поделиться
HTML-код
  • Опубликовано: 13 дек 2024

Комментарии • 14

  • @sallyparkes4329
    @sallyparkes4329 2 года назад +1

    Hi, I've managed to get some of my data to import but not all columns. What code do I need to import 3 Excel columns (which are numeric) and store them in an int field and decimal fields? Those three columns are failing to import. The int field just shows 0 for all records which the two fields that are decimal are empty. Thank you.

    • @lahilatech5946
      @lahilatech5946  2 года назад +1

      Did you assigned your data from excel to correct column of the table? i am worried you assign the data to wrong column. Will be better if you debug your code to see if there any mistake on it.

    • @sallyparkes4329
      @sallyparkes4329 2 года назад

      @@lahilatech5946 thank you so much for your swift reply. I worked it out just now. I just had to put Convert.ToInt32(ProjectID)!!

    • @lahilatech5946
      @lahilatech5946  2 года назад

      ​@@sallyparkes4329 yes, you need to converted it. decimal.Parse(your string) for decimal column

  • @abdalrhmanfahiem9501
    @abdalrhmanfahiem9501 2 года назад

  • @Booster09999
    @Booster09999 Год назад

    I have trying it but the button is not working

  • @tookay5
    @tookay5 Год назад

    wouldn't this take a significant time for a file with 10s of thousands of rows? Normally you would want to save a data upload using a bulk insert mechanism.

  • @shubhamparade533
    @shubhamparade533 2 года назад +1

    How to avoid duplicate records insert

    • @lahilatech5946
      @lahilatech5946  2 года назад

      it's simple, you can achieved that by doing validation all items on excel list before you saved item to the database.

  • @Booster09999
    @Booster09999 Год назад

    I gett in error on $, document.ready(function (){})

    • @lahilatech5946
      @lahilatech5946  Год назад

      Have you include the jquery file correctly?

    • @Booster09999
      @Booster09999 Год назад

      @@lahilatech5946 yes need to any packages ?

  • @MOHAMMADIMRAN-by3ge
    @MOHAMMADIMRAN-by3ge 2 года назад

    vendors.bundle.js:1 Uncaught TypeError: Illegal invocation
    at r (vendors.bundle.js:1:71005)
    at Se (vendors.bundle.js:1:70897)
    at _.param (vendors.bundle.js:1:71196)
    at Function.ajax (vendors.bundle.js:1:74515)
    at HTMLButtonElement. (UploadFromExcel.js:23:19)
    at HTMLButtonElement.dispatch (vendors.bundle.js:1:41525)
    at g.handle (vendors.bundle.js:1:39555)

    • @lahilatech5946
      @lahilatech5946  Год назад

      Hi Mohammad Imran, i thought the problem is on your ajax post parameters. can you post your ajax function?