Im having problems with importing Excel too.
Govner: can i see your code? I have made something simular to you, i think, and i don't even get the numbers back from the excel. When i look in a cell, that i know contains a number formated as a number, i get a DBNull returned...
I have to go into Excel and make the cell "Number formated as text", before i can read it. Any i deas?
1 DbProviderFactory factory = DbProviderFactories.GetFactory("System.Data.OleDb");
2
3 try
4 {
5 using (DbConnection connection = factory.CreateConnection())
6 {
7 connection.ConnectionString = connectionString;
8
9 using (DbCommand command = connection.CreateCommand())
10 {
11 // Sheet1$ comes from the name of the worksheet
12 command.CommandText = "SELECT * FROM [Sheet1$]";
13
14 connection.Open();
15
16 using (DbDataReader dr = command.ExecuteReader())
17 {
18 while (dr.Read())
19 {
20 //This one returns DbNull
21 //I have removed alot of business logic from this while
22 dr[5].ToString().Trim();
23
24 }
25
26 }
27 }
28 }
29 }
30 }