我不知道我的程序发生了什么,我花了(4)四分钟来加载我的代码结果......有人可以告诉我为什么吗?有人能告诉我如何解决这个加载问题吗?
这是我的代码:
Imports System.Data.SqlClient
Public Class Form1
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim str As String = "Data Source=######;Initial Catalog=###;Persist Security Info=True;User ID=#####;Password=#####"
Dim con As New SqlConnection(str)
Dim cmd As String = "Select ControlNo,EmpNo,CheckOutDate,CheckOutTime,TaxiNo,PlateNo,Model,Make from dbo.ChkInOut"
Dim adpt As New SqlDataAdapter(com, con)
Dim myDataSet As New DataSet()
adpt.Fill(myDataSet, "dbo.ChkInOut")
Dim myDataTable As DataTable = myDataSet.Tables(0)
Dim tempRow As DataRow
For Each tempRow In myDataTable.Rows
'ListBox1.Items.Add((tempRow("ControlNo") & " (" & tempRow("EmpNo") & ")" & " (" & tempRow("CheckOutDate") & ")" & " (" & tempRow("CheckOutTime") & ")" & " (" & tempRow("TaxiNo") & ")" & " (" & tempRow("PlateNo") & ")" & " (" & tempRow("Model") & ")" & " (" & tempRow("Make") & ")"))
'ListBox1.Items.Add((tempRow("ControlNo") & " (" & tempRow("EmpNo") & ")"))
ListBox1.Items.Add(tempRow("ControlNo") & " " & tempRow("EmpNo") & " " & tempRow("CheckOutDate") & " " & tempRow("CheckOutTime") & " " & tempRow("TaxiNo") & " " & tempRow("PlateNo") & " " & tempRow("Model") & " " & tempRow("Make") & " ")
Next
End Sub
End Class