❔ fastest way to add a datatable to database
Hello, so I was doing a task and my final step was adding a datatable to a database. I did connections and everything and I for loop over every element in data table and added it to database.( I never worked with C# so I don’t really know much about its classes) .Recruiter told me there is a faster way. Can someone please help me with code ? (assume I have DataTable dataTable with all the data and I want to import it into database with features (EmployeeID, Name,Date)
8 Replies
not sure how you did it, but maybe they were looking for bulk insert if there was a large amount of data to import
what is bulkinsert?
a class you can import?
GitHub
GitHub - borisdj/EFCore.BulkExtensions: Entity Framework EF Core ef...
Entity Framework EF Core efcore Bulk Batch Extensions with BulkCopy in .Net for Insert Update Delete Read (CRUD), Truncate and SaveChanges operations on SQL Server, PostgreSQL, MySQL, SQLite - GitH...
or is it this one? https://entityframework-extensions.net/bulk-insert
EF Core Bulk Insert | Optimize Data Insertion for EF6 and EF Core
Optimize Entity Framework insert performance with EF Core Bulk Insert Extensions. Easily insert large numbers of entities and customize options with compatibility across all EF versions, including EF Core 7, 6, 5, 3, and EF6. Improve your database operations - try it now.
will check it out thaks
Was this issue resolved? If so, run
/close
- otherwise I will mark this as stale and this post will be archived until there is new activity./close
Was this issue resolved? If so, run
/close
- otherwise I will mark this as stale and this post will be archived until there is new activity.