I have a C# program that I want to import an Excel file into Microsoft SQL Server 2008 R2.
Can someone give me a link or tutorial where I can fully understand on how to this?
I've been doing this for a long time and I really don't have an idea on how to implement this.
Please help. Thanks.
I think that most useful answers already have been given. I am not going to describe the C# way, but rathher give you an easy way of doing it without C#:
Open your MS Access, link your MS SQL database via ODBC, open your table in Access and paste your Excel records there via copy-paste (preformatted to match the table schema.)
This way is very fast and useful when you do some one-time data import.
Check out this post :
Bulk Insertion of Data Using C# DataTable and SQL server OpenXML function
Import Data from Excel to SQL Server
// Create Connection to Excel Workbook
We can Import excel to sql server like this
using (OleDbConnection connection = new OleDbConnection(excelConnectionString)){
OleDbCommand command = new OleDbCommand ("Select ID,Data FROM [Data$]", connection);
This code may also help you.