Ver Mensaje Individual
  #1 (permalink)  
Antiguo 23/01/2009, 04:57
ZeroZ
 
Fecha de Ingreso: junio-2002
Ubicación: España
Mensajes: 348
Antigüedad: 21 años, 11 meses
Puntos: 8
Problemas lectura Excel con .NET

Hola, para leer un archivo Excel y mostrarlo en mi página uso el siguiente método:

Código PHP:
public static DataSet ImportExcel()
        {
            
DataSet output = new DataSet();

            
using (OleDbConnection conn = new OleDbConnection(connectionString))
            {
                
conn.Open();

                
DataTable schemaTable GetSchemaTable(connectionString);

                foreach (
DataRow schemaRow in schemaTable.Rows)
                {
                    
string sheet schemaRow["TABLE_NAME"].ToString();

                    
OleDbCommand cmd = new OleDbCommand("SELECT * FROM [" sheet "]"conn);
                    
cmd.CommandType CommandType.Text;

                    
DataTable outputTable = new DataTable(sheet);
                    
output.Tables.Add(outputTable);
                    new 
OleDbDataAdapter(cmd).Fill(outputTable);
                }
            }
            return 
output;
        } 
Pero las celdas que tienen valores numéricos no me las muestra, sin embargo las que tienen texto o texto y números si las muestra.

Porqué puede ser?
__________________
Bicis nuevas y de segunda mano: Bicibid