' Collection of code snippets by Arne Vajhøj 
' (likely posted to comp.os.vms/INFO-VAX, INFO-TPU, MACRO32, eksperten.dk, newz.dk, LinkedIn or other place sometime between 1990 and now) 
Imports System
Imports System.IO
Imports System.Windows.Forms

Module Program
    Sub Main()
        Dim sr As StreamReader = New StreamReader("C:\data.txt")
        Dim line As String
        Dim pin As String = "NULL"
        Dim phone As String = "NULL"
        Dim message As String = ""
        line = sr.ReadLine
        While line <> Nothing
            If line.StartsWith("Pin: ") Then
                pin = line.Substring("Pin: ".Length)
            End If
            If line.StartsWith("Phone: ") Then
                phone = line.Substring("Phone: ".Length)
            End If
            If line.StartsWith("Message: ") Then
                message = line.Substring("Message: ".Length)
            End If
            line = sr.ReadLine
        End While
        sr.Close()
        Dim sqlstr As String
        sqlstr = "INSERT INTO tab VALUES (" & pin & "," & phone & ",'" & message & "')"
        MessageBox.Show(sqlstr)
    End Sub
End Module
