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
| Function Reperoire(ByVal txt As String) As String
Dim pose As Long = txt.IndexOf(":") + 1
txt = txt.Substring(pose, txt.Length - pose).Replace("\", ":").Replace(":", ":\").Replace("\\", "\")
If txt.Substring(0, 1) = "\" Then txt = "\" + txt
Return txt
End Function
Private Function OpenFtxt(folder As String, SQL As String, Shemat As String, Titre As Boolean) As DataTable
Dim objWriter As New System.IO.StreamWriter($"{folder}\schema.ini", False)
objWriter.WriteLine(Shemat)
objWriter.Close()
Dim con As String = $"Provider=Microsoft.Jet.OLEDB.4.0;Data Source={folder};Extended Properties='text;HDR={If(Titre, "Yes", "No")};FMT=Delimited';"
Dim dt As New DataTable
Using Adp As New OleDbDataAdapter(SQL, con)
Try
Adp.Fill(dt)
Return dt
Catch ex As Exception
Return Nothing
End Try
End Using
End Function |