 
			
				02/12/2009, 14:29
			
			
			     |  
      |    |    |    Fecha de Ingreso: noviembre-2009  
						Mensajes: 26
					  Antigüedad: 16 años Puntos: 0     |        |  
  |      Respuesta: Duda cargar fichero ado.net        Holas,  
Este es el código que estoy intentado hacer jejeej, no se si fufará... :( de todos modos, el nombre del archivo puede ser diferente, y me gustaria que así fuera... si recupero la ruta, como separo el nombre del archivo de la ruta?... aiiins, que chungo por favor... no hay ningun codigo ya escrito para esto? ... :(    
Código:
      
Public Class Form1
    Private Sub Button1_Click( _
        ByVal sender As System.Object, _
        ByVal e As System.EventArgs) Handles Button1.Click
        ' inicializar el array para los encabezados de columna
        Dim aCol() As String = {"fecha_import", "incidentfile", "VIM", "type", "fecharegistro", "numeroincidencia", "operatorhf", "RA", "fixed_cost", "cost_kms", "type_cost", "days", "cost_replace", "ve,icle_recovery", "acommodation", "home_jur", "jurney", "vehicle_storage", "taxi", "Other", "Tot_no_vat", "Tot_vat", "comments", "nombre_archivo"}
        Dim ofd As New OpenFileDialog()
        ofd.ShowDialog()
        Dim ruta_csv As String = ofd.SafeFileName
    End Sub
Private Sub Cargar_Csv( _
        ByVal xlApp As Excel._Application)
        Dim Button1 As System.Object
        Dim xlLibro As Excel._Workbook
        Dim xlHoja As Excel._Worksheet
        Dim xlHojas As Excel.Sheets
        Dim xlRango As Excel.Range = Nothing
        Dim ruta_csv As String = Nothing
        With Button1
            .xlApp = New Excel.Application()
            .xlLibro = xlApp.Workbooks.Open(ruta_csv, Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value, _
            Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value, _
            Missing.Value, Missing.Value, Missing.Value)
            .xlHojas = xlLibro.Sheets
            .xlHoja = DirectCast(xlHojas(), Excel._Worksheet)
            .xlApp.Visible = False
            .xlApp.ScreenUpdating = False
            .xlApp.DisplayAlerts = False
        End With
    End Sub
  graxxx            |