ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Office Web Component Spreadsheet: C# (https://www.excelbanter.com/excel-programming/303001-office-web-component-spreadsheet-c.html)

AA2e72E

Office Web Component Spreadsheet: C#
 
I can use the OWC.Spreadsheet component successfully from VB6. From C#, I cannot figure out how to activate another worksheet. The (working) code for the default active sheet is:

axSpreadsheet1.ActiveSheet.ConnectionString="Drive r={Oracle in OraHome9};Server=D2K1Z01J;Database=HR;UID=AA;PWD=O RACLE";

axSpreadsheet1.ActiveSheet.CommandText="Select * from hr.employees;";

I want to be able to do this:

axSpreadsheet1.Worksheets[2].ConnectionString= ....
axSpreadsheet1.Worksheetd[2].CommandText= ....

This works in VB6: I get all kind of errors in C#. I have searched the WEB for a solution and posted the query in the C# newsgroup a few days ago: no joy at all.

Can someone show me the way? Please.



AA2e72E

Office Web Component Spreadsheet: C#
 
I should have mentioned that I am usinig OWC11 (Office 2003).

"AA2e72E" wrote:

I can use the OWC.Spreadsheet component successfully from VB6. From C#, I cannot figure out how to activate another worksheet. The (working) code for the default active sheet is:

axSpreadsheet1.ActiveSheet.ConnectionString="Drive r={Oracle in OraHome9};Server=D2K1Z01J;Database=HR;UID=AA;PWD=O RACLE";

axSpreadsheet1.ActiveSheet.CommandText="Select * from hr.employees;";

I want to be able to do this:

axSpreadsheet1.Worksheets[2].ConnectionString= ....
axSpreadsheet1.Worksheetd[2].CommandText= ....

This works in VB6: I get all kind of errors in C#. I have searched the WEB for a solution and posted the query in the C# newsgroup a few days ago: no joy at all.

Can someone show me the way? Please.




All times are GMT +1. The time now is 06:16 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com