Read Stock Pair Names in Excel and Store them in a List
Author: Shourui
Creation Date: 9/15/2010 2:39 PM
profile picture

Shourui

#1
Can anyone help me translate the following 4.5 chartscript?
It read stock pair information from a excel file and store them in different Tlists. Thanks a lot.
CODE:
Please log in to see this code.
profile picture

Eugene

#2
There are two ways that you can go: translating this to C# or rewriting the code from scratch. There are countless examples on the net so below you'll find just a couple of pointers:

1. The first one assumes you're still using COM i.e. Excel.Sheet.

Reading Excel From C#
How to automate Excel by using Visual C# to fill or to obtain data in a range by using arrays

I guess that Visual Studio Tools for Office is a prerequisite.

2. The other means dropping COM and reading Excel sheet names and cell values using database technology:

Reading and Writing Excel Spreadsheets Using ADO.NET C# DbProviderFactory

It's good that you're using "XLS" files and not "XLSX". If your operating system is 32-bit, consider yourself lucky: using ODBC is relatively easy.

Using Office 2007/2010 files and especially a 64-bit Windows edition opens a big can of worms. MS Jet 4.0 is incompatible with Win x64, so instead of the built-in driver, installing an additional component would be required (2007/2010 Office System Driver: Data Connectivity Components, x64 version) and the connection string will be different.

This website uses cookies to improve your experience. We'll assume you're ok with that, but you can opt-out if you wish (Read more).