调试过程显着减慢,有时页面根本不加载 [英] Debugging process is slowed down dramatically, sometimes the page doesn't load at all
本文介绍了调试过程显着减慢,有时页面根本不加载的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我的网络应用程序有时很难加载,而其他时候根本不会加载,这让我想知道为什么?我怀疑阵列和我正在使用的随机化。请程序员,我需要你的帮助,如果我有一些最佳实践可以帮助解决这个问题。这是我使用的代码:
My web app sometimes struggles to load and other times doesn''t load at all, and this has got me wondering why? I suspect the array, and the randomization i''m using. Please programmers, i need your help, if there is some best practise i can do to help solve this problem. This is the code i use:
If Not IsPostBack Then
Me.MultiView1.ActiveViewIndex = 0
cnn.Open()
cmd.Connection = cnn
Dim arbit As New Random
Randomize()
X: For i = 0 To a.GetUpperBound(0)
t = arbit.Next(1, 99)
If Array.IndexOf(a, t) = -1 Then
a(i) = t
Else
GoTo X
End If
Next
For i = 0 To 40
cmd.CommandText = "select * from English where Serial=" & a(i)
adp = New SqlDataAdapter(cmd.CommandText, cnn)
adp.Fill(ds, "English")
Next
cnn.Close() 'connection closed
dt = New DataTable("Answered")
dt.Columns.Add("Serial", GetType(Integer))
dt.Columns.Add("question", GetType(String))
dt.Columns.Add("choice1", GetType(String))
dt.Columns.Add("choice2", GetType(String))
dt.Columns.Add("choice3", GetType(String))
dt.Columns.Add("choice4", GetType(String))
dt.Columns.Add("correct", GetType(String))
dt.Columns.Add("selected", GetType(Integer))
Dim r As DataRow
For Each r In ds.Tables("English").Rows
dr = dt.NewRow
dr("Serial") = dt.Rows.Count + 1
dr("question") = r.Item("question")
dr("choice1") = r.Item("choice1")
dr("choice2") = r.Item("choice2")
dr("choice3") = r.Item("choice3")
dr("choice4") = r.Item("choice4")
dr("correct") = r.Item("correct")
dr("selected") = -1
dt.Rows.Add(dr)
Next
Session("Answered") = dt
Call show()
推荐答案
替换下面的代码:
Substituted this code below:
X: For i = 0 To a.GetUpperBound(0)
t = arbit.Next(1, 99)
If Array.IndexOf(a, t) = -1 Then
a(i) = t
Else
GoTo X
End If
Next
以下这个
:
for this one below:
While I <= 40
t = arbit.Next(1, 99)
If Array.IndexOf(a, t) = -1 Then
a(I) = t
I += 1
End If
End While
它运作良好
And it works just well
这篇关于调试过程显着减慢,有时页面根本不加载的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文