Private Sub btnSpeichern_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnSpeichern.Click
Dim dateistrom As StreamReader
Dim datensatz As String
Dim datfeld() As String
Dim i As Integer
Dim dbcom As OleDbCommand = New OleDbCommand
Dim bLesen As Boolean = True
Try
OleDbConnection1.Open()
If OpenFileDialog1.ShowDialog() = DialogResult.OK Then
dateistrom = New StreamReader(OpenFileDialog1.FileName)
datensatz = dateistrom.ReadLine()
While (bLesen)
datensatz = dateistrom.ReadLine
If datensatz = Nothing Then Exit While
datfeld = datensatz.Split(", ")
For i = 0 To datfeld.Length - 1
datfeld(i).Replace(""""c, " ")
datfeld(i).Trim()
Next
Dim ss As String
ss = "INSERT INTO Table_IlonA_0 ( UCPTlogTime, UCPTpointName, UCPTlocation, UCPTlogSourceAddress, UCPTpointStatus, UCPTvalueDef, UCPTvalue, UCPTunit, Datum )" _
& " VALUES ('" & datfeld(0) & "','" & datfeld(1) & "','" & datfeld(2) & "','" & datfeld(3) & "','" & datfeld(4) & "','" & datfeld(5) & "','" & datfeld(6) & "','" & datfeld(7) & "','" & Now() & "')"
dbcom.Connection = OleDbConnection1
dbcom.CommandText = ss
dbcom.ExecuteNonQuery()
End While
OleDbConnection1.Close()
End If
Catch ex As Exception
MessageBox.Show(ex.Message)
End Try
End Sub
End Class
Private Sub btnSpeichern_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnSpeichern.Click
Dim dateistrom As StreamReader
Dim datensatz As String
Dim datfeld() As String
Dim i As Integer
Dim dbcom As OleDbCommand = New OleDbCommand
Dim bLesen As Boolean = True
Try
OleDbConnection1.Open()
If OpenFileDialog1.ShowDialog() = DialogResult.OK Then
dateistrom = New StreamReader(OpenFileDialog1.FileName)
datensatz = dateistrom.ReadLine() 'erster Satz wird ausgeblendet
While (bLesen)
datensatz = dateistrom.ReadLine
If datensatz = Nothing Then Exit While
datfeld = datensatz.Split(", ")
For i = 0 To datfeld.Length - 1
datfeld(i).Replace(""""c, " ")
datfeld(i).Trim()
Next
Dim ss As String
ss = "INSERT INTO Table_IlonA_0 ( UCPTlogTime, UCPTpointName, UCPTlocation, UCPTlogSourceAddress, UCPTpointStatus, UCPTvalueDef, UCPTvalue, UCPTunit, Datum )" _
& " VALUES ('" & datfeld(0) & "','" & datfeld(1) & "','" & datfeld(2) & "','" & datfeld(3) & "','" & datfeld(4) & "','" & datfeld(5) & "','" & datfeld(6) & "','" & datfeld(7) & "','" & Now() & "')"
dbcom.Connection = OleDbConnection1
dbcom.CommandText = ss
'MessageBox.Show(ss)
dbcom.ExecuteNonQuery()
End While
OleDbConnection1.Close()
End If
Catch ex As Exception
MessageBox.Show(ex.Message)
End Try
End Sub
End Class
Private Sub btnSpeichern_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnSpeichern.Click
Dim dateistrom As StreamReader
Dim datensatz As String
Dim datfeld() As String
Dim i As Integer
Dim dbcom As OleDbCommand = New OleDbCommand
Dim bLesen As Boolean = True
Try
OleDbConnection1.Open()
If OpenFileDialog1.ShowDialog() = DialogResult.OK Then
dateistrom = New StreamReader(OpenFileDialog1.FileName)
datensatz = dateistrom.ReadLine() 'erster Satz wird ausgeblendet
While (bLesen)
datensatz = dateistrom.ReadLine
If datensatz = Nothing Then Exit While
datfeld = datensatz.Split(", ")
For i = 0 To datfeld.Length - 1
datfeld(i).Replace(""""c, " ")
datfeld(i).Trim()
Next
Dim ss As String
ss = "INSERT INTO Table_IlonA_0 ( UCPTlogTime, UCPTpointName, UCPTlocation, UCPTlogSourceAddress, UCPTpointStatus, UCPTvalueDef, UCPTvalue, UCPTunit, Datum )" _
& " VALUES ('" & datfeld(0) & "','" & datfeld(1) & "','" & datfeld(2) & "','" & datfeld(3) & "','" & datfeld(4) & "','" & datfeld(5) & "','" & datfeld(6) & "','" & datfeld(7) & "','" & Now() & "')"
dbcom.Connection = OleDbConnection1
dbcom.CommandText = ss
'MessageBox.Show(ss)
dbcom.ExecuteNonQuery()
End While
OleDbConnection1.Close()
End If
Catch ex As Exception
MessageBox.Show(ex.Message)
End Try
End Sub
GSerg писал(а):Сколько элементов в массиве datfeld перед четвёртым разом
Сейчас этот форум просматривают: нет зарегистрированных пользователей и гости: 54