level 7
下面是代码:
Private Sub Timer1_Tick(sender As Object, e As EventArgs) Handles Timer1.Tick
If sr.Peek() > -1 Then
varLine = sr.ReadLine()
varLine = varLine.Replace("[kms]", "[district]")
If varLine <> "" Then
If varLine.Contains("INSERT INTO") = True Then
Me.TextBox1.Text = varLine
Dim rowindex As Integer = 1
Dim instructioncodelength As Integer = 0
Me.ProgressBar1.Maximum = varLine.Length
Me.ProgressBar1.Minimum = 0
Me.ProgressBar1.Value = instructioncodelength
2019年12月05日 07点12分
2
level 7
For Each c As String In varLine
If st.Count > 0 Then
Dim stacktopelement As String = st.Peek
If c <> ")" Then
If stacktopelement <> c Then
If c <> "'" Then
Try
If c = "," Then
If rowindex = 2 Then
st.Push(c)
ElseIf rowindex = 4 Then
st.Push(c)
ElseIf rowindex = 5 Then
st.Push(c)
ElseIf rowindex = 6 Then
st.Push(c)
ElseIf rowindex = 7 Then
st.Push(c)
End If
Else
data &= c
End If
Catch ex As Exception
End Try
Else
st.Push(c)
End If
Else
st.Pop()
If rowindex = 10 Then
Column10 = data
ElseIf rowindex = 9 Then
Column9 = data
ElseIf rowindex = 8 Then
Try
Column8 = data
Catch ex As Exception
Column8 = 0
End Try
ElseIf rowindex = 7 Then
Column7 = data
ElseIf rowindex = 6 Then
Try
Column6 = data
Catch ex As Exception
Column6 = 0
End Try
ElseIf rowindex = 5 Then
Column5 = data
ElseIf rowindex = 4 Then
Column4 = "NULL"
ElseIf rowindex = 3 Then
Try
Column3 = data
Catch ex As Exception
Column3 = 0
End Try
ElseIf rowindex = 2 Then
Column2 = data
Else
Column1 = data
End If
rowindex += 1
data = String.Empty
End If
Else
2019年12月05日 07点12分
3
level 7
st.Pop()
rowindex = 0
newRow = dt.NewRow()
newRow("ID") = Column1
newRow("name") = Column2
newRow("adcode") = Column3
newRow("dataother") = Column4
newRow("citycode") = Column5
newRow("lat") = Column6
newRow("lng") = Column7
newRow("level") = Column8
newRow("parentid") = Column9
newRow("sort") = Column10
dt.Rows.Add(newRow)
data = String.Empty
End If
Else
If c = "(" Then
st.Push(c)
End If
End If
instructioncodelength += 1
Me.ProgressBar1.Value = instructioncodelength
Next
End If
Else
Exit Sub
End If
Else
Me.Timer1.Stop()
My.Forms.Form2.Show()
end if
end sub
2019年12月05日 07点12分
4