View Single Post
  #1 (permalink)  
Old November 20th, 2006, 02:25 PM
livehed livehed is offline
Authorized User
 
Join Date: Jun 2005
Location: , , .
Posts: 11
Thanks: 0
Thanked 0 Times in 0 Posts
Default Help needed regarding Excel Interop

Hi all,

I'm working on an Excel Interop application using C#.
I'm facing 2 problems described below:

1.Am using OleDbCommand and INSERT INTO query
to insert data from a .Net datatable into an excel sheet.
Am getting the following error during the same:
"The field is too small to accept the amount of data you attempted to add.
Try inserting or pasting less data."
Any idea,how to fix this???

2.I'm trying to delete a worksheet from an existing excel file using the following C# code.But, the worksheet is not getting deleted...

Am doing something wrong...??Is there any other approach...??
foreach(Excel.Worksheet ws in wkBook.Sheets)

{

if (ws.Name.ToString().Trim().ToUpper() == viewName.ToUpper())

{

ws.Delete();

break;

}

}

//Save changes to Excel file
wkBook.Save();
wkBook.Close(true, excelFilePath, Type.Missing);

Thanks in advance...!

Cheers,
Reply With Quote