Private Sub ΔιάβασμαΑρχείουΠελατών1(ByVal dst As String)
Try
Dim sql_command As New System.Data.SqlClient.SqlCommand("", connectionOE)
Dim Fi1 As IO.FileInfo
Fi1 = My.Computer.FileSystem.GetFileInfo(CType(dst, String))
Dim gr As Integer = ((Fi1.Length.ToString()) / 1856) + 1
Dim df As New StreamReader(dst, System.Text.Encoding.GetEncoding(737))
Dim grs As String = df.ReadToEnd
df.Close()
Dim sw As StreamWriter = New StreamWriter("c:\Dps\MyTest.txt")
Dim i As Integer
For i = 0 To gr
Dim s As String = grs.Substring((832 * i) + (1024 * i), 832 + 1024)
sw.WriteLine(s)
ΤιμέςΓραμμήςΠελατών1(s, sql_command)
Next i
sw.Close()
Catch exc As Exception
MsgBox(exc.Message, MsgBoxStyle.Exclamation, "Λάθος! Ορισμός Αρχείων Πελατών1!")
End Try
End Sub
Private Sub ΤιμέςΓραμμήςΠελατών1(ByVal s As String, ByVal sql_command As System.Data.SqlClient.SqlCommand)
Dim s1 As String = s.Substring(1, 13)
Dim s2 As String = Regex.Replace(s.Substring(15, 31), "[ ]", "")
sql_command.CommandText = "INSERT INTO Πελάτες1 VALUES ('" _
& s1 & "','" _
& s2 & "','" _
& s.Substring(47, 13) & "','" _
& s.Substring(62, 18) & "','" _
& s.Substring(80, 15) & "','" _
& s.Substring(96, 60) & "','" _
& s.Substring(156, 120) & "','" _
& s.Substring(277, 30) & "','" _
& s.Substring(308, 30) & "','" _
& s.Substring(339, 9) & "','" _
& s.Substring(349, 30) & "','" _
& s.Substring(380, 30) & "','" _
& s.Substring(411, 30) & "','" _
& s.Substring(442, 9) & "','" _
& s.Substring(452, 30) & "','" _
& s.Substring(483, 15) & "','" _
& s.Substring(499, 15) & "','" _
& s.Substring(515, 15) & "','" _
& s.Substring(531, 15) & "','" _
& s.Substring(547, 3) & "','" _
& s.Substring(551, 3) & "','" _
& s.Substring(555, 3) & "','" _
& s.Substring(559, 3) & "','" _
& s.Substring(565, 13) & "','" _
& s.Substring(579, 13) & "','" _
& s.Substring(643, 3) & "','" _
& s.Substring(669, 3) & "','" _
& s.Substring(673, 3) & "','" _
& s.Substring(680, 55) & "','" _
& s.Substring(736, 19) & "','" _
& s.Substring(756, 10) & "','" _
& s.Substring(767, 5) & "','" _
& s.Substring(773, 12) & "','" _
& s.Substring(786, 2) & "','" _
& s.Substring(789, 3) & "','" _
& s.Substring(793, 3) & "','" _
& s.Substring(797, 3) & "','" _
& s.Substring(801, 3) & "','" _
& s.Substring(813, 12) & "','" _
& s.Substring(826, 12) & "','" _
& s.Substring(839, 12) & "','" _
& s.Substring(852, 12) & "')"
sql_command.ExecuteNonQuery()
End Sub
Ευχαριστώ γιά τον Πίνακα