Visual Basic.NET - Pasar *.txt a tabla en VB.NET

 
Vista:

Pasar *.txt a tabla en VB.NET

Publicado por Jor (20 intervenciones) el 07/03/2005 15:00:54
Hola estoy haciendo el proyecto final de carrera y necesito ayuda para pasar registros de un archivo de texto a una tabla en visual basic.net.

Un ejemplo seria suficiente.Gracias
Valora esta pregunta
Me gusta: Está pregunta es útil y esta claraNo me gusta: Está pregunta no esta clara o no es útil
0
Responder

RE:Pasar *.txt a tabla en VB.NET

Publicado por corben dallas (11 intervenciones) el 08/03/2005 09:57:41
Yo lo hago así:

OleDbConnection1.Open()

FileOpen(1, "c:\nombrefichero.txt", OpenMode.Input)
LíneaDeTexto = LineInput(1)

For iContador = 0 To LOF(1) - 115 Step 115 ----> longitud de los registros a leer

strAcumulador = LíneaDeTexto.Substring(iContador, 115)

OleDbInsertar.Parameters("codigo_cliente").Value = Val(strAcumulador.Substring(13, 5))

OleDbInsertar.Parameters("numero_recibo").Value = iAcumulador2

OleDbInsertar.Parameters("fecha_cobro").Value = strAcumulador.Substring(73, 2) & "/" & strAcumulador.Substring(75, 2) & "/" & strAcumulador.Substring(77, 4)

iFilas = OleDbInsertar.ExecuteNonQuery
Next

OleDbConnection1.Close()

FileClose(1) 'cerrar archivo
Valora esta respuesta
Me gusta: Está respuesta es útil y esta claraNo me gusta: Está respuesta no esta clara o no es útil
0
Comentar