如何提高速度呀有代码(数据库)?
     下面的代码速度慢的要命,如何能快点
comm1.CommandText = "SELECT 类型,日期,备刀份数,备刀人员,操作次数,新,一次,二次,三次,四次,五次,断新,断一,断二,断三,断四,断五,没新,没一,没二,没三,没四,没五 from ZT_DATA_History where 类型=1 or 类型=2 or 类型=3 or 类型=4 or 类型=5 or 类型=6 or 类型=7"
        reader = comm1.ExecuteReader
        Do While reader.Read
            sl = reader("新") + reader("一次") + reader("二次") + reader("三次") + reader("四次") + reader("五次")
            dd = reader("断新") + reader("断一") + reader("断二") + reader("断三") + reader("断四") + reader("断五")
            mysl = reader("没新") + reader("没一") + reader("没二") + reader("没三") + reader("没四") + reader("没五")
            DateTimeTEMP = reader("日期")
            Dim xh As Integer = DateTimeTEMP.Hour
            Dim fz As Integer = DateTimeTEMP.Minute
            If xh < 7 Or (xh < 8 And fz < 30) Then '当时间小于7:30时候将日期减1
                DateTimeTEMP = DateTimeTEMP.AddDays(-1)
            End If
            comm2.CommandText = "SELECT ID from ZT_beidao_TJ where 日期=#" & DateTimeTEMP.Year & "-" & DateTimeTEMP.Month & "-" & DateTimeTEMP.Day & "# and ID='" & reader("备刀人员") & "'"
            reader2 = comm2.ExecuteReader
            Do While reader2.Read
                bdr = reader2("ID")
            Loop
            reader2.Close()
            Select Case reader("类型")
                Case 1
                    If bdr = "" Then
                        comm2.CommandText = "insert into ZT_beidao_TJ(日期,ID,备刀份数,备刀次数,备刀数量) values('" & DateTimeTEMP.Year & "-" & DateTimeTEMP.Month & "-" & DateTimeTEMP.Day & "','" & reader("备刀人员") & "'," & reader("备刀份数") & "," & reader("操作次数") & "," & sl & ")"
                        comm2.ExecuteNonQuery()
                    Else
                        comm2.CommandText = "Update ZT_beidao_TJ set 备刀份数=备刀份数+" & reader("备刀份数") & ",备刀次数=备刀次数+" & reader("操作次数") & ",备刀数量=备刀数量+" & sl & " where 日期=#" & DateTimeTEMP.Year & "-" & DateTimeTEMP.Month & "-" & DateTimeTEMP.Day & "# and ID='" & reader("备刀人员") & "'"
                        comm2.ExecuteNonQuery()
                    End If
                Case 2
                    If bdr = "" Then
                        comm2.CommandText = "insert into ZT_beidao_TJ(日期,ID,填份份数,填份次数,填份数量) values('" & DateTimeTEMP.Year & "-" & DateTimeTEMP.Month & "-" & DateTimeTEMP.Day & "','" & reader("备刀人员") & "'," & reader("备刀份数") & "," & reader("操作次数") & "," & sl & ")"
                        comm2.ExecuteNonQuery()
                    Else
                        comm2.CommandText = "Update ZT_beidao_TJ set 填份份数=填份份数+" & reader("备刀份数") & ",填份次数=填份次数+" & reader("操作次数") & ",填份数量=填份数量+" & sl & " where 日期=#" & DateTimeTEMP.Year & "-" & DateTimeTEMP.Month & "-" & DateTimeTEMP.Day & "# and ID='" & reader("备刀人员") & "'"
                        comm2.ExecuteNonQuery()
                    End If
                Case 3
                    If bdr = "" Then
                        comm2.CommandText = "insert into ZT_beidao_TJ(日期,ID,填加次数,填加数量) values('" & DateTimeTEMP.Year & "-" & DateTimeTEMP.Month & "-" & DateTimeTEMP.Day & "','" & reader("备刀人员") & "'," & reader("操作次数") & "," & sl & ")"
                        comm2.ExecuteNonQuery()
                    Else
                        comm2.CommandText = "Update ZT_beidao_TJ set 填加次数=填加次数+" & reader("操作次数") & ",填加数量=填加数量+" & sl & " where 日期=#" & DateTimeTEMP.Year & "-" & DateTimeTEMP.Month & "-" & DateTimeTEMP.Day & "# and ID='" & reader("备刀人员") & "'"
                        comm2.ExecuteNonQuery()
                    End If
                Case 4
                    If bdr = "" Then
                        comm2.CommandText = "insert into ZT_beidao_TJ(日期,ID,完出次数,完出数量) values('" & DateTimeTEMP.Year & "-" & DateTimeTEMP.Month & "-" & DateTimeTEMP.Day & "','" & reader("备刀人员") & "'," & reader("操作次数") & "," & sl & ")"
                        comm2.ExecuteNonQuery()
                    Else
                        comm2.CommandText = "Update ZT_beidao_TJ set 完出次数=完出次数+" & reader("操作次数") & ",完出数量=完出数量+" & sl & " where 日期=#" & DateTimeTEMP.Year & "-" & DateTimeTEMP.Month & "-" & DateTimeTEMP.Day & "# and ID='" & reader("备刀人员") & "'"
                        comm2.ExecuteNonQuery()
                    End If
                Case 5
                    If bdr = "" Then
                        comm2.CommandText = "insert into ZT_beidao_TJ(日期,ID,出库次数,出库数量) values('" & DateTimeTEMP.Year & "-" & DateTimeTEMP.Month & "-" & DateTimeTEMP.Day & "','" & reader("备刀人员") & "'," & reader("操作次数") & "," & sl & ")"
                        comm2.ExecuteNonQuery()
                    Else
                        comm2.CommandText = "Update ZT_beidao_TJ set 出库次数=出库次数+" & reader("操作次数") & ",出库数量=出库数量+" & sl & " where 日期=#" & DateTimeTEMP.Year & "-" & DateTimeTEMP.Month & "-" & DateTimeTEMP.Day & "# and ID='" & reader("备刀人员") & "'"
                        comm2.ExecuteNonQuery()
                    End If
                Case 6
                    If bdr = "" Then
                        comm2.CommandText = "insert into ZT_beidao_TJ(日期,ID,完返次数,完返数量,完返断刀,完返没用) values('" & DateTimeTEMP.Year & "-" & DateTimeTEMP.Month & "-" & DateTimeTEMP.Day & "','" & reader("备刀人员") & "'," & reader("操作次数") & "," & sl & "," & dd & "," & mysl & ")"
                        comm2.ExecuteNonQuery()
                    Else
                        comm2.CommandText = "Update ZT_beidao_TJ set 完返次数=完返次数+" & reader("操作次数") & ",完返数量=完返数量+" & sl & ",完返断刀=完返断刀+" & dd & ",完返没用=完返没用+" & mysl & " where 日期=#" & DateTimeTEMP.Year & "-" & DateTimeTEMP.Month & "-" & DateTimeTEMP.Day & "# and ID='" & reader("备刀人员") & "'"
                        comm2.ExecuteNonQuery()
                    End If
                Case 7
                    If bdr = "" Then
                        comm2.CommandText = "insert into ZT_beidao_TJ(日期,ID,返库次数,返库数量,返库断刀,返库没用) values('" & DateTimeTEMP.Year & "-" & DateTimeTEMP.Month & "-" & DateTimeTEMP.Day & "','" & reader("备刀人员") & "'," & reader("操作次数") & "," & sl & "," & dd & "," & mysl & ")"
                        comm2.ExecuteNonQuery()
                    Else
                        comm2.CommandText = "Update ZT_beidao_TJ set 返库次数=返库次数+" & reader("操作次数") & ",返库数量=返库数量+" & sl & ",返库断刀=返库断刀+" & dd & ",返库没用=返库没用+" & mysl & " where 日期=#" & DateTimeTEMP.Year & "-" & DateTimeTEMP.Month & "-" & DateTimeTEMP.Day & "# and ID='" & reader("备刀人员") & "'"
                        comm2.ExecuteNonQuery()
                    End If
            End Select
            bdr = ""
        Loop
        reader.Close()