Click here to Skip to main content
15,896,269 members
Articles / Programming Languages / SQL

Excel to SQL without JET or OLE (Version 2)

Rate me:
Please Sign up or sign in to vote.
4.29/5 (5 votes)
5 Oct 2010CPOL4 min read 61.5K   4.9K   48  
Import an Excel Workbook ".xls" or ."xlsx" into SQL without the use of JET or OLE
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace ExcelToDB
{
    /// <summary>
    /// Error Message Event Argument
    /// Used to transfer an error message via an event
    /// </summary>
    public class ExcError_EventArgs
    {
        private Exception _Error = null;
        /// <summary>
        /// The Exception error message to transfer
        /// </summary>
        public Exception Error { get { return this._Error; } }

        /// <summary>
        /// Creates and instance of the ExcError_EventArgs class
        /// </summary>
        /// <param name="Error">The Exception error message to transfer</param>
        public ExcError_EventArgs(Exception Error)
        {
            this._Error = Error;
        }

        /// <summary>
        /// Creates and returns a string representation of the current ExcError_EventArgs
        /// </summary>
        /// <returns>The Message Field of the Exception</returns>
        public override string ToString()
        {
            return this.Error.Message;
        }
    }
}

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
United Kingdom United Kingdom
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.

Comments and Discussions