I am getting through about 5000 queries before I get a stack overflow exception at the line where I call NewQuery2 again. Any ideas on what I can do to prevent this? I am trying to run about 40,000 queries.
Public Sub NewQuery2()
Dim ID2 As String
Try
Dim ID As String
ID = listBox1.Items(Next1)
ID2 = ID
Dim sql As String = "select INIT.MPI_MEMHEAD.MEMSTAT from INIT.MPI_MEMHEAD where INIT.MPI_MEMHEAD.MEMIDNUM = '" + ID + "'"
Dim cmd As New OracleCommand(sql, conn)
cmd.CommandType = CommandType.Text
Dim dr As OracleDataReader = cmd.ExecuteReader()
dr.Read()
If dr.GetString(0) = "M" Then
txtMerge.Text = txtMerge.Text + 1
Else
textBox1.Text = textBox1.Text + 1
End If
dr.Dispose
cmd.Dispose
Catch ex As Exception
richTextBox1.Text = richTextBox1.Text + ex.Message + vbCrLf + ID2
End Try
Application.DoEvents
If Next1 = listbox1.Items.Count - 1 Then
conn.Dispose
Else
Next1 = Next1 + 1
NewQuery2()
End If
End SUb
Application.DoEventsblogs.msdn.com/b/jfoscoding/archive/2005/08/06/448560.aspx