Advertisement
Advertisement
| 07.21.2008 at 10:35AM PDT, ID: 23582640 |
|
[x]
Attachment Details
|
||
1: 2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: 15: 16: 17: 18: 19: 20: 21: 22: 23: 24: 25: 26: 27: 28: 29: 30: 31: 32: 33: 34: 35: 36: 37: 38: 39: 40: 41: 42: 43: 44: 45: 46: 47: 48: 49: 50: 51: 52: 53: 54: 55: 56: 57: 58: 59: 60: 61: 62: 63: 64: 65: 66: 67: 68: 69: 70: 71: 72: 73: 74: 75: 76: 77: 78: 79: 80: 81: 82: 83: 84: 85: 86: 87: 88: 89: 90: 91: 92: 93: 94: |
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim campos(28) As String
Dim control As Integer
Using MyReader As New Microsoft.VisualBasic.FileIO.TextFieldParser(TextBox1.Text)
MyReader.TextFieldType = FileIO.FieldType.Delimited
MyReader.SetDelimiters(";")
Dim currentRow As String()
While Not MyReader.EndOfData
Try
currentRow = MyReader.ReadFields()
Dim currentField As String
control = 0
For Each currentField In currentRow
campos(control) = currentField
control = control + 1
Console.WriteLine(control)
Next
Dim RegIdentificacion As BDLRDataSet.IdentificacionRow
RegIdentificacion = BDLRDataSet.Identificacion.NewRow
RegIdentificacion.Rut = campos(0)
RegIdentificacion.Nombre = campos(1)
RegIdentificacion.RED = campos(19)
BDLRDataSet.Identificacion.Rows.Add(RegIdentificacion)
BDLRDataSet.Identificacion.AcceptChanges()
Dim RegDBS_Cl As BDLRDataSet.DBS_ChiRow
RegDBS_Cl = BDLRDataSet.DBS_Chi.NewRow
RegDBS_Cl.RUT = campos(0)
RegDBS_Cl.R1M = campos(2)
RegDBS_Cl.R10 = campos(3)
RegDBS_Cl.R12 = campos(4)
RegDBS_Cl.R18 = campos(5)
RegDBS_Cl.R27 = campos(6)
RegDBS_Cl.R39 = campos(7)
RegDBS_Cl.R40 = campos(8)
RegDBS_Cl.R41 = campos(9)
BDLRDataSet.DBS_Chi.Rows.Add(RegDBS_Cl)
BDLRDataSet.DBS_Chi.AcceptChanges()
Dim RegDBS_Ar As BDLRDataSet.DBS_ArgRow
RegDBS_Ar = BDLRDataSet.DBS_Arg.NewRow
RegDBS_Ar.Rut = campos(0)
RegDBS_Ar.R05 = campos(10)
RegDBS_Ar.R06 = campos(11)
RegDBS_Ar.RBP = campos(12)
BDLRDataSet.DBS_Arg.Rows.Add(RegDBS_Ar)
BDLRDataSet.DBS_Arg.AcceptChanges()
Dim RegIAS As BDLRDataSet.IASRow
RegIAS = BDLRDataSet.IAS.NewRow
RegIAS.RUT = campos(0)
RegIAS.R1M = campos(20)
RegIAS.R10 = campos(21)
RegIAS.R12 = campos(22)
RegIAS.R18 = campos(23)
RegIAS.R27 = campos(24)
RegIAS.R39 = campos(25)
RegIAS.R40 = campos(26)
RegIAS.R41 = campos(27)
BDLRDataSet.IAS.Rows.Add(RegIAS)
BDLRDataSet.IAS.AcceptChanges()
Dim Compras_Bo As BDLRDataSet.Compras_BoRow
Compras_Bo = BDLRDataSet.Compras_Bo.NewRow
Compras_Bo.Rut = campos(0)
Compras_Bo.Userid = campos(16)
BDLRDataSet.Compras_Bo.Rows.Add(Compras_Bo)
BDLRDataSet.Compras_Bo.AcceptChanges()
Dim Compras_Cl As BDLRDataSet.Compras_ClRow
Compras_Cl = BDLRDataSet.Compras_Cl.NewRow
Compras_Cl.Rut = campos(0)
Compras_Cl.Userid = campos(17)
BDLRDataSet.Compras_Cl.Rows.Add(Compras_Cl)
BDLRDataSet.Compras_Cl.AcceptChanges()
Dim Compras_Uy As BDLRDataSet.Compras_UyRow
Compras_Uy = BDLRDataSet.Compras_Uy.NewRow
Compras_Uy.Rut = campos(0)
Compras_Uy.Userid = campos(18)
BDLRDataSet.Compras_Uy.Rows.Add(Compras_Uy)
BDLRDataSet.Compras_Uy.AcceptChanges()
Catch ex As Microsoft.VisualBasic.FileIO.MalformedLineException
MsgBox("Linea " & ex.Message & "no es valida y no será cargada.")
End Try
End While
End Using
CheckBox1.Checked = vbYes
CheckBox1.Refresh()
End Sub
|