Tuesday, June 30, 2009

Simple Excel 2007 Data Loader to SQL 2008 Server

Introduction

This is a very simple Excel 2007 data loader to SQL 2008 database. I am using SqlBulkCopy class to make data load fast. (10K record loaded in less than 3s).

One catch: You will need existing table in SQL DB with matching columns. I skipped dynamic table creation to keep the code simple.

Using the Code

This is the most basic version, without error checking to make the code clear. Below is the completed code behind the form.

Button 1 - Opens the Excel file.

Button 2 - Uploads data to SQL Server.


See full detail: http://www.codeproject.com/KB/cs/Excel_Loader.aspx

No comments: