C# Tutorial - Import data from Excel to SQL Server | FoxLearn

แชร์
ฝัง
  • เผยแพร่เมื่อ 3 พ.ย. 2024
  • How to Import data from Excel to SQL Server using Z.Dapper, ExcelDataReader in C# .NET Windows Forms Application.
    Website: foxlearn.com
    import data from excel to sql server using c# windows application

ความคิดเห็น • 106

  • @dinaldomichinge4166
    @dinaldomichinge4166 3 ปีที่แล้ว +3

    Please can you share de code, i facing trouble on ready object, the method "AsDataSet". I want see the import part. I already was i your web page i saw the code but the import part is cutted.

  • @mafmaf80
    @mafmaf80 4 ปีที่แล้ว +2

    an error occured while retrieving the InformationSchemaTable information. See the inner exception for details.
    i get this error when i click the import button at the end. i checked every code and any detail may help online but stucked. i need some help.

  • @ayyanar9805
    @ayyanar9805 4 ปีที่แล้ว

    What i say about you...Previous Comments will say all and Your the Best FoxLearn.

  • @simeonbryukhov
    @simeonbryukhov ปีที่แล้ว

    thanks your explanation is very helpful

  • @EJSP28
    @EJSP28 ปีที่แล้ว

    Hi, ¿How I can do this, but having more excel sheets in the excel file, and each sheet have to import to a table in SQL?, thx

  • @shomari169
    @shomari169 4 ปีที่แล้ว +1

    whats the difference between Dapper ORM and Z.Dapper please

  • @ashishjog
    @ashishjog 4 ปีที่แล้ว +1

    Great Tutorial and quality as always, Fox Learn, I am having one issue, the column name in EXCEL contains "Spaces" and Some Special Chars too, e.g. Customer ID, Sr No. etc; so how to add those in class file e.g. shown in 11:55 ,
    public string "ColumnNameWithSpace" {get; set;}
    Please help me in this case!

  • @furkanguney5871
    @furkanguney5871 ปีที่แล้ว

    Would Datatable work instead of class?

  • @julsfadriquelan3230
    @julsfadriquelan3230 2 ปีที่แล้ว

    how about the updating the table by importing the new and updated csv file ?
    do you have any tutorial on that ? thanks for the reponse

  • @anavagomez
    @anavagomez 4 ปีที่แล้ว +2

    Hello and thank you for this tutorial, it has been very helpful. I was wondering if you have an example on the same example, but with some validation to avoid duplicate entries. Thank you very much for your work.

    • @shubhamparade533
      @shubhamparade533 2 ปีที่แล้ว

      Hi same i want to add validation for avoid duplicate records

  • @nagaprasannaeluri8294
    @nagaprasannaeluri8294 2 ปีที่แล้ว

    Hi, I have tried this it is taking more time to execute dB.BulkInsert line , not stopping . Can you help me

  • @KristinaKristina-cf7ll
    @KristinaKristina-cf7ll 2 ปีที่แล้ว

    Hello, I already have the data in the database.how to add data from excel in this case?

  • @ga7853
    @ga7853 5 ปีที่แล้ว +1

    Thank you, Thank you, Thank you, Can not thank you enough.

    • @foxlearn
      @foxlearn  5 ปีที่แล้ว

      You're welcome. Thank you so much !

  • @cabalsdemon
    @cabalsdemon 3 ปีที่แล้ว

    on8:28 where you add your
    CboSheet.Items.Add(table.TableName);
    it keeps telling me the name table doesnt exist in the current context
    and i have typed word for word can you please help me

  • @akshaylate2780
    @akshaylate2780 9 หลายเดือนก่อน +1

    System.NotSupportedException: 'No data is available for encoding 1252. For information on defining a custom encoding, see the documentation for the Encoding.RegisterProvider method.' i am getting erroe from this code will u help me

    • @burakcanduzcan
      @burakcanduzcan 3 หลายเดือนก่อน

      adding this to main method might solve the problem:
      System.Text.Encoding.RegisterProvider(System.Text.CodePagesEncodingProvider.Instance)

  • @goverdhanjayaram3683
    @goverdhanjayaram3683 3 ปีที่แล้ว

    Excellent ! Thank you very much for this video.

  • @playfree9238
    @playfree9238 4 ปีที่แล้ว

    What shoudl I put to the tableCollection If I want all sheets to be uploaded?

  • @mistersimple7303
    @mistersimple7303 4 ปีที่แล้ว

    Hello Sir, I am using visual studio 2015 and sql server 2019. I tried to connect it to visual studio 2015 and it worked. However, when I try to open new query in visual studio from sql server 2019 connection, "an incompatible sql version was detected" window pops out. Is it true that both of them are incompatible? Thanks. It also appears when i try to right click the table inside it when i try to show table data.

  • @manertermanertering7470
    @manertermanertering7470 3 ปีที่แล้ว

    can you make a delete button that delete the imported file in the databse

  • @Aravindkumar-dt7ut
    @Aravindkumar-dt7ut 4 ปีที่แล้ว +1

    How to map the column name with space. For example if the column name is First name in SQL than how can we map in c# code

    • @kasparskalnins4296
      @kasparskalnins4296 4 ปีที่แล้ว

      I would like to know this as well

    • @kasparskalnins4296
      @kasparskalnins4296 4 ปีที่แล้ว

      Also, what if the values in the SQL database aren't all just varchars - I have a situation where float values are imported as NULL

  • @r50142
    @r50142 5 ปีที่แล้ว +2

    Foxlearn can u make a tutorial were you make a terminal like cmd? I need to know i wanna make something like that. You can use console C# or just desktop app C#

    • @r50142
      @r50142 5 ปีที่แล้ว

      i forgot to subscribe :(((

    • @foxlearn
      @foxlearn  5 ปีที่แล้ว

      OK. Thank you for your suggestion !

  • @narinyalcin5398
    @narinyalcin5398 3 ปีที่แล้ว

    Thank uuuuu soooooo Muchhh !!!!!! u save my life !! :))))

  • @subhangamers
    @subhangamers 3 ปีที่แล้ว

    Awesome Video Thank you so much

  • @manertermanertering7470
    @manertermanertering7470 3 ปีที่แล้ว

    What about if i have a foreign key because i create a two different data gridview eith different items but have a foreign key

    • @foxlearn
      @foxlearn  3 ปีที่แล้ว

      Insert parent first, then child. and each parent you should add key

  • @clidton
    @clidton 3 ปีที่แล้ว

    how to mapping sheet column and class variable means any one choose and map both column before show on datagrid just like sql import wizard

  • @sheriffh8357
    @sheriffh8357 3 ปีที่แล้ว

    Thank youuuuuuuuuuuu very very much!!!!!!!!!!!!!!!!!!!!!!!!!!!

  • @slashd
    @slashd 2 ปีที่แล้ว

    Its faster to just save the Excel file as CSV and in SQL Server: rightclick database > Tasks > Import Flat File > done!

  • @zeynelbozkale
    @zeynelbozkale 4 ปีที่แล้ว

    Hi ! Thanks for you Tutorrial. This is really awesome...

  • @chong-arini
    @chong-arini 10 หลายเดือนก่อน +1

    How to fix Dapper trial expired

  • @namvuong5629
    @namvuong5629 4 ปีที่แล้ว

    I use visual studio 2010 so i can not add z. Dapper plus like this video. So how can i do this without z. Dapper plus, i want to import excel file to sql server. Fox Learn help me please!

    • @foxlearn
      @foxlearn  4 ปีที่แล้ว

      You can download offline library from nuget

  • @kcr6291
    @kcr6291 3 ปีที่แล้ว

    thank you for this! very clear tutorial :)

    • @foxlearn
      @foxlearn  3 ปีที่แล้ว

      Glad it was helpful!

  • @malakawitharana3871
    @malakawitharana3871 4 ปีที่แล้ว

    Have a problem with binding source to datagridview in 13.18 seconds you clicked on datagrid view datasource selecting dropdown and selecting “other data sources”. But in my case it wouldn't appear.what should i do to add it?

    • @muskape
      @muskape 4 ปีที่แล้ว

      Did you find out a solution? I have the same issue ;-)

    • @andreoliveira3236
      @andreoliveira3236 3 ปีที่แล้ว

      @@muskape How about you? Ever found a solution?

    • @manvix1988
      @manvix1988 2 ปีที่แล้ว

      Did you find out a solution? I have the same issue, I use VS 2019

  • @vikydogphotovideo3370
    @vikydogphotovideo3370 4 ปีที่แล้ว

    HI! Thanks for your tutorial, it's very nice! Could you help me, since I'm from Access and I'm a beginner in C #? I made this project, but instead of using the mdf database I'm using dataset (in my case called "Database"). My excel file has 2 columns (IDComuni and Comune), and in the Dataset I created the "Comuni" table with 2 fields (IDComuni "int32" and Comune). Now the problem is to load this data from the Datagridviewer to the table.
    // --- DapperPlusManager.Entity () .Table ("Comuni");
    using (IDbConnection db = new SqlConnection ("? ....?"))
    {
    db.BulkInsert (list); - //
    How can I modify this syntax so that it can load everything in the "Comuni" table? Thank you!

  • @Bloodyshinta1
    @Bloodyshinta1 4 ปีที่แล้ว

    when I try to run the program at 9:10 I get an Exception Thrown,
    System.NullReferenceException: 'Object reference not set to an instance of an object.' System.Windows.Forms.ComboBox.SelectedItem.Get returned null.
    I've copied everything in this video word for word, is there something I've missed?

    • @foxlearn
      @foxlearn  4 ปีที่แล้ว

      Have you add sheet name to combobox?

    • @Bloodyshinta1
      @Bloodyshinta1 4 ปีที่แล้ว

      @@foxlearn the program crashes before I am able to use the form. The exception points to this line of the code.
      private void CboSheet_SelectedIndexChanged(object sender, EventArgs e)
      {
      DataTable dt = tableCollection[cboSheet.SelectedItem.ToString()];
      dataGridView1.DataSource = dt;

  • @venisejoseph2157
    @venisejoseph2157 4 ปีที่แล้ว

    how to add validation if all the imported data already exists in the database ?

    • @foxlearn
      @foxlearn  4 ปีที่แล้ว

      I think you can write stored procedure, check data already exists before insert

  • @Lungeloization
    @Lungeloization 2 ปีที่แล้ว

    Can anyone please where is this variable declared customerBindingSource customerBindingSource.DataSource = list;

  • @ogiaang8621
    @ogiaang8621 4 ปีที่แล้ว

    Hi. My DataGridView can not pick up Class Customer after I create it on visual Studio

  • @baganaakh
    @baganaakh 4 ปีที่แล้ว

    DapperPlusManager.Entity().Table("Account"); what is this line doing ?

    • @foxlearn
      @foxlearn  4 ปีที่แล้ว

      I help you mapping account to table account
      For example: entity class: Accounts you can map to account table or user table....

  • @muhammedkoka2079
    @muhammedkoka2079 5 ปีที่แล้ว

    Awesome!

    • @foxlearn
      @foxlearn  5 ปีที่แล้ว

      Thank you !

  • @LalitKumar-ni2hc
    @LalitKumar-ni2hc 4 ปีที่แล้ว

    Thank You !!

    • @foxlearn
      @foxlearn  4 ปีที่แล้ว

      Thank you !

  • @julsfadriquelan3230
    @julsfadriquelan3230 2 ปีที่แล้ว

    how do i add csv file ?

  • @harunaabaldeh2006
    @harunaabaldeh2006 4 ปีที่แล้ว

    "An error occurred while retrieving the InformationShemaTable information. See the inner exception for details." This is the I have when I click import to database please some help me out

  • @nhan687
    @nhan687 5 ปีที่แล้ว

    Con you make a tutorial that excute the excel file that contain SQL command to SQL Server

    • @foxlearn
      @foxlearn  5 ปีที่แล้ว

      Can you describe more details. thank you !

  • @robertpatino4508
    @robertpatino4508 4 ปีที่แล้ว

    can I also apply for xamarin forms?

    • @foxlearn
      @foxlearn  4 ปีที่แล้ว

      Thank you for your suggestion !

  • @hassanf.ashour4134
    @hassanf.ashour4134 5 ปีที่แล้ว +1

    AsDataSet Not definition DataSet result = reader.AsDataSet(new ExcelReaderConfiguration()

    • @foxlearn
      @foxlearn  5 ปีที่แล้ว

      You should install ExcelDataReader.DataSet. Thank you !

  • @addakerrar8626
    @addakerrar8626 4 ปีที่แล้ว

    any solution for Import data from Excel to phpmyadmin

    • @foxlearn
      @foxlearn  4 ปีที่แล้ว +1

      Let me try to research. Thank you !

  • @nawalchehabi6171
    @nawalchehabi6171 4 ปีที่แล้ว

    thank you, can't thank u enough

    • @sergiodexter3895
      @sergiodexter3895 3 ปีที่แล้ว

      Pro trick: watch movies on Flixzone. Been using them for watching lots of of movies recently.

    • @kingcamdyn7976
      @kingcamdyn7976 3 ปีที่แล้ว

      @Sergio Dexter Yup, have been watching on Flixzone} for months myself :)

    • @greysonaron5556
      @greysonaron5556 3 ปีที่แล้ว

      @Sergio Dexter Yup, been watching on Flixzone} for years myself :)

    • @kodaharlan3053
      @kodaharlan3053 3 ปีที่แล้ว

      @Sergio Dexter yea, have been using Flixzone} for months myself =)

    • @connorroyce9975
      @connorroyce9975 3 ปีที่แล้ว

      @Sergio Dexter yup, I have been watching on flixzone} for years myself :)

  • @ABsazerNer
    @ABsazerNer 5 ปีที่แล้ว

    Can you make a tutorial how to insert PDF file to SQL as file

    • @foxlearn
      @foxlearn  5 ปีที่แล้ว

      OK. Thank you for your suggestion. I'll make soon.

  • @MSEBOOT
    @MSEBOOT 3 ปีที่แล้ว

    please , i want this project

  • @albakkah
    @albakkah 4 ปีที่แล้ว

    Awesome!
    I need your help.
    I want to import data this data using ADO.NET Entity Data Model.
    I have DB Connection, Example:
    using(dbDemoEntities db = new dbDemoEntities())
    {
    -----------
    }
    How I can replace this method to above.
    public void Insert(List list)
    {
    DapperPlusManager.Entity().Table("Student");
    using (IDbConnection db = new SqlConnection("Data Source=DESKTOP-7F885GH\\SQLEXPRESS;Initial Catalog=Demo;Integrated Security=True"))
    {
    db.BulkInsert(list);
    }
    }
    Thanks in Advance FoxLearn.

  • @agamurat3019
    @agamurat3019 4 ปีที่แล้ว

    it ignores russian characrters. how to handle that please help m,e

    • @foxlearn
      @foxlearn  4 ปีที่แล้ว

      You should define your column is nvarchar, then try to import

  • @omeraslan4238
    @omeraslan4238 5 ปีที่แล้ว

    How can i block multiple data ?

    • @foxlearn
      @foxlearn  5 ปีที่แล้ว +1

      Can you describe more details. thank you !

    • @omeraslan4238
      @omeraslan4238 5 ปีที่แล้ว

      @@foxlearn example i have customer id 2614 saved on my database.when i add gridview excel customer id 2614 messagebox.show this customer id already exist

  • @cptegonbr140
    @cptegonbr140 5 ปีที่แล้ว

    is c# dying?

    • @foxlearn
      @foxlearn  5 ปีที่แล้ว

      What do you mean?

    • @hichamo-sfh177
      @hichamo-sfh177 5 ปีที่แล้ว

      Can u explain more your question..?

  • @fred_3516
    @fred_3516 4 ปีที่แล้ว

    Alguien que haga el mismo video y lo traduzca?

    • @foxlearn
      @foxlearn  4 ปีที่แล้ว

      What do you mean?

  • @khaleed7991
    @khaleed7991 4 ปีที่แล้ว

    sir why Filemode and File access are error in mine??

    • @macmaz1000
      @macmaz1000 4 ปีที่แล้ว

      I got the same problem. Did you get any solution ?

  • @meenunited
    @meenunited 2 ปีที่แล้ว

    beware Dapper Plus is not free !!!! they will expired with in one month after use this library

  • @alirezaabedi1885
    @alirezaabedi1885 5 ปีที่แล้ว

    ....

    • @foxlearn
      @foxlearn  5 ปีที่แล้ว

      Thank you !

  • @cromuelbarut9859
    @cromuelbarut9859 3 ปีที่แล้ว

    how to do this with phpmyadmin database?

    • @foxlearn
      @foxlearn  3 ปีที่แล้ว

      Sorry man. I'm not using phpmyadmin

    • @johnalbertrosanes6055
      @johnalbertrosanes6055 3 ปีที่แล้ว

      @@foxlearn i already use phpmyadmin and it works