C
C#2y ago
Salakhosh

❔ 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
friedice
friedice2y ago
not sure how you did it, but maybe they were looking for bulk insert if there was a large amount of data to import
Salakhosh
SalakhoshOP2y ago
what is bulkinsert? a class you can import?
friedice
friedice2y ago
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...
friedice
friedice2y ago
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.
Salakhosh
SalakhoshOP2y ago
will check it out thaks
Accord
Accord2y ago
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.
Salakhosh
SalakhoshOP2y ago
/close
Accord
Accord2y ago
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.
Want results from more Discord servers?
Add your server