Dim dn As String = "" Dim pa1 As String = "" 'Geting LDIF file Dim Contents = IO.File.ReadAllLines("test_ldif.txt") 'Created a class called "ldap.vb" with all the tags that are there in the LDIF file 'Created a object of it Dim objLdap As New ldap() Dim objLdapList As New List(Of ldap)() For x As Integer = 0 To Contents.Count - 1 If Not String.IsNullOrEmpty(Contents(x)) Then 'Omitting Spaces in the file pa1 = Contents(x).Split(":")(0) 'Getting the tag If pa1.Equals("dn") Then 'Checking for the matching tag and adding to the obj objLdapList.Add(objLdap) 'Adding Item to the list(DN is the Primary Key) objLdap = New [ldap]() 'Refreshing the obj dn = Contents(x).Split(":")(1) objLdap.dn = dn End If If pa1.Equals("employee") Then dn = Contents(x).Split(":")(1) 'Getting the value objLdap.employee = dn 'Adding it to the classObj End If If pa1.Equals("countryname") Then dn = Contents(x).Split(":")(1) objLdap.countryname = dn sb.AppendLine("<br/>countryname:" + dn) End If . . . . . . End If Next 'Converting List object to CSV String Dim strnewCSV = GetCSV(objLdapList) 'Saving Logic here...
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)