Ver Mensaje Individual
  #4 (permalink)  
Antiguo 16/05/2007, 01:22
adventum
 
Fecha de Ingreso: mayo-2007
Mensajes: 7
Antigüedad: 17 años
Puntos: 0
Re: cambiar puntos por comas en txt e importarlo a mdb

muchas gracias, lo solucione de esta forma:



Imports ADOX
Imports System
Imports System.Data
Imports System.Data.OleDb

Module puntos_por_comas


Sub Main()
' Leemos el contenido del archivo de texto.
Dim sr As New System.IO.StreamReader("C:\visual studio\campos\texto.txt")
Dim origen As String = sr.ReadToEnd
sr.Close()

' Reemplazamos el punto por la coma.
Dim destino As String = origen.Replace(".", ",")

' Guardamos el resultado en un nuevo archivo de texto.
Dim sw As New System.IO.StreamWriter("C:\visual studio\campos\Destino.txt")
sw.Write(destino)
sw.Close()


Dim cnn As New ADODB.Connection

cnn.Open( _
"Provider=Microsoft.Jet.OLEDB.4.0;" & _
"Data Source=C:\visual studio\campos\base.mdb;" & _
"Jet OLEDB:Engine Type=4;")

cnn.Execute("SELECT * INTO [Modo1] FROM [Text;DATABASE=C:\visual studio\campos\;HDR=YES;FMT=Delimited(;)].[destino.txt]")

cnn.Close()

End Sub



End Module
Editar/Borrar Mensaje