Muhamad Haris Setiawan Muhamad Haris Setiawan - 10 months ago 49 Question

get string from txt file on

hi i have problem in my code, i just want to call a .txt file insert into my table database but i can not find the functional at all
it my .txt file


where | is an end of field, i can call the txt file, but not to call one by one of string and insert into database, can any one help me with this one? thanks.

Answer Source

You said that you can read your .txt file but cannot call it one by one?
read it as string then split it one by one.
Here: You can split your input

Public Class Form1

Dim input As String = "101772|CS101772039001567|28012015|101772039|83521318|CJVAN02"

Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
    Dim delimiter As Char = "|"
    Dim substrings() As String = input.Split(delimiter)

    For Each substring In substrings
End Sub
End Class

This is just a little tip. you can start it from here.