Hello Joe,
I still cannot reproduce the symptom on my side. At the bottom of this
message, you can find my test steps. Joe, do you mind sending a
reproducible project to me?
By the way, you mentioned the #VALUE! Errors. Are there UDFs in your xls?
===== MY TEST STEPS =====
1. Create a XLS in Excel 2003. In Sheet1, I format ColumnA as () and
ColumnB as %
2. Input values to the cells as:
A1 = ID
A2 = -123
A3 = 123
B1 = Name
B2 = 1
B3 = 2
3. Create a C# console project in Visual Studio with the code:
static void Main(string[] args)
{
string connStr = "Provider=Microsoft.Jet.OLEDB.4.0;Data
Source=D:\\Book1.xls;Extended Properties=\"Excel 8.0;HDR=Yes; \"";
OleDbConnection conn = new OleDbConnection(connStr);
conn.Open();
OleDbCommand cmd = new OleDbCommand();
cmd.Connection = conn;
cmd.CommandText = "SELECT ID, NAME FROM [Sheet1$]";
OleDbDataReader reader = cmd.ExecuteReader();
while (reader.Read())
{
Debug.Print(reader[0].ToString());
Debug.Print(reader[1].ToString());
}
reader.Close();
conn.Close()
}
4. Debug the project, and see the debug info in the Output window:
-123
1
123
2
Regards,
Jialiang Ge (
[email protected], remove 'online.')
Microsoft Online Community Support
=================================================
Delighting our customers is our #1 priority. We welcome your comments and
suggestions about how we can improve the support we provide to you. Please
feel free to let my manager know what you think of the level of service
provided. You can send feedback directly to my manager at:
(e-mail address removed).
This posting is provided "AS IS" with no warranties, and confers no rights.
=================================================