automatic run while debugging

TKap

Member
Joined
Nov 5, 2012
Messages
9
Programming Experience
Beginner
This is my piece of code.
I try to debug this code that i have written in the form load event.
As soon as it enters the first for loop(i.e line 8), it loads the form and basically ends the form load event instead of entering the loop and going to the statements that follow.
Why is it so?

1 da = New OleDb.OleDbDataAdapter("select booking_id from roomMaster", con)
2 da.Fill(ds, "roomMaster")
3 dt = ds.Tables(0)
4 da2 = New OleDb.OleDbDataAdapter("select bookingID from bookingMaster", con)
5 da2.Fill(ds2, "bookingMaster")
6 dt2 = ds2.Tables(0)
7 Dim x As Integer = ds.Tables(0).Rows.Count
8 For j = 0 To x - 1
9 a = dt.Rows(j).Item(6).ToString
10 Dim y As Integer = ds2.Tables(0).Rows.Count
11 For k = 0 To y - 1
12 b = dt2.Rows(k).Item(1).ToString
13 If StrComp(a, b) = 0 Then
14 Exit For
15 End If
16 Next
17 Dim flag As String = "yes"
18 cmd2 = New OleDb.OleDbCommand
19 cmd2.Connection = con
20 cmd2.CommandType = CommandType.Text
21 cmd2.CommandText = "update rooMaster set availability= @f where booking_id = @a "
22 cmd2.Parameters.AddWithValue("@f", flag)
23 cmd2.Parameters.AddWithValue("@a", a)
24 i = cmd2.ExecuteNonQuery()
25 MsgBox("updated")
26 Next
 
Back
Top