Problemas al Insertar Datos desde C# a una hoja de excel mediante una BD

Estoy utilizando SQL server 2008, Visual Studio C# 2010 ultimate y excel 2010 .Este es mi código.

using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Xml.Linq;
using Microsoft.Office.Tools.Excel;
using Microsoft.VisualStudio.Tools.Applications.Runtime;
using Excel = Microsoft.Office.Interop.Excel;
using Office = Microsoft.Office.Core;
using System.Drawing;
namespace ExcelTemplate4
{
public partial class ThisWorkbook
{
private void ThisWorkbook_Startup(object sender, System.EventArgs e)
{
try
{
System.Data.OleDb.OleDbConnection MyConnection;
System.Data.OleDb.OleDbCommand myCommand = new System.Data.OleDb.OleDbCommand();
string sql = null;
MyConnection = new System.Data.OleDb.OleDbConnection( provider=Microsoft.Jet.OLEDB.4.0;Data Source='c:\\csharp.net-informations.xls';Extended Properties=Excel 8.0; );
MyConnection.Open();
myCommand.Connection = MyConnection;
sql = Insert into [Sheet1$C3] values('23') ;
myCommand.CommandText = sql;
myCommand.ExecuteNonQuery();
MyConnection.Close();
}
catch (Exception ex)
{
MessageBox.Show(ex.ToString());
}
}
private void ThisWorkbook_Shutdown(object sender, System.EventArgs e)
{
}
}
}

Y ESTE ES EL ERROR QUE ME ARROJA,,

AGRADECERÍA SU AYUDA, de antemano MUCHAS GRACIAs

Error1Ya se ha importado un ensamblado con la misma identidad 'Microsoft.Vbe.Interop, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c'. Intente quitar una de las referencias duplicadas. C:\Program Files (x86)\Microsoft Visual Studio 10.0\Visual Studio Tools for Office\PIA\Office14\Microsoft.Vbe.Interop.dll ExcelTemplate4

Añade tu respuesta

Haz clic para o