Computers/Language
2012. 4. 28. 22:01
Microsoft Office 2010: Primary Interop Assemblies Redistributable
send data to Excel
strInsert.Append("Insert Into [" + NewXLSheetName + xlSheetIndex.ToString() +
"$](" + SqlInsert.ToString() + ") Values (");
foreach (DataColumn dCol in DTable.Columns)
{
if (dCol.DataType.ToString().ToLower().Contains("int"))
{
if (DTable.Rows[count][dCol.Ordinal].ToString() == "")
strInsert.Append("NULL");
else
strInsert.Append(DTable.Rows[count][dCol.Ordinal]);
Get data from Excel
OleDbDataAdapter xlDA = new OleDbDataAdapter("Select" + AdditionalFields +
" * from [" + xlSheetName + "$] ", xlConn);
xlDA.Fill(xlTDS);
http://www.codeproject.com/Articles/33271/Import-and-Export-to-Multiple-Worksheets