Dim DMC_No As New List(Of Integer)
cmd.CommandText = "SELECT MC_No FROM tbl_MainComp WHERE EquipTag= '" & TextBox1.Text & "'"
Using reader As OleDb.OleDbDataReader = cmd.ExecuteReader()
While reader.Read()
DMC_No.Add(reader.GetInt32(reader.GetOrdinal("MC_No")))
End While
End Using
Dim DFM_No As New List(Of Integer)
For i = 0 To DMC_No.Count - 1
MessageBox.Show(DMC_No.Item(i)) 'This line to to test is there any value in array list and it get the correct value
cmd.CommandText = "SELECT FM_No FROM tbl_FailureMode WHERE MC_No= " & DMC_No.Item(i) & ""
Using reader2 As OleDb.OleDbDataReader = cmd.ExecuteReader()
While reader2.Read()
DFM_No.Add(reader2.GetInt32(reader2.GetOrdinal("FM_No")))
End While
End Using
MessageBox.Show(DMC_No.Item(i))'This line to to test is there any value in array list and it get the correct value
Next i
I think my problem is occuring at this line
cmd.CommandText = "SELECT FM_No FROM tbl_FailureMode WHERE MC_No= " & DMC_No.Item(i) & ""
When i set the DMC_No.Item(i) value as hard code it able to run smoothly, but when i add the DMC_No.Item(i) and i check the value by using
Dim sResult As String = String.Join(", ", DFM_No.ToArray())
Dim str As String
str = String.Join(",", DFM_No)
MessageBox.Show(str)
It does not return any value