Ver Mensaje Individual
  #2 (permalink)  
Antiguo 03/12/2007, 13:13
daltahir
 
Fecha de Ingreso: junio-2006
Mensajes: 61
Antigüedad: 17 años, 10 meses
Puntos: 0
Re: Leer Excel desde ASP .Net

con esta funcion desde un excel tu generas un dataset, saludos

Private Function ConvertiraDataset(ByVal path As String) As DataSet
Dim oDs As New DataSet
Dim oConn As New OleDbConnection
Dim oCmd As New OleDbCommand
Dim oDa As New OleDbDataAdapter
Try
If File.Exists(path) Then
oConn.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & path & "; Extended Properties= Excel 8.0;"
oConn.Open()
oCmd.CommandText = "SELECT * FROM [objetivos$]"
oCmd.Connection = oConn
oDa.SelectCommand = oCmd
oDa.Fill(oDs)
End If
Return oDs
Catch
Return Nothing
End Try


End Function