p2p.wrox.com Forums

p2p.wrox.com Forums (http://p2p.wrox.com/index.php)
-   C# (http://p2p.wrox.com/forumdisplay.php?f=22)
-   -   Help needed regarding Excel Interop (http://p2p.wrox.com/showthread.php?t=50534)

livehed November 20th, 2006 02:25 PM

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,


All times are GMT -4. The time now is 07:31 PM.

Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.