hi,
now i'm hving problem to show card number that is not currently in used. let me give the example. I have 3 card numbers (A, B and C). A & B are user card number while C is temporary card number. I want to attached C to A. so my datagrid view will show the temporary card number before i select the card number. after i select A attached by C, the temporary card number for B should not be displayed.
here is the codes.
Private Sub LoadTempCards()
Try
Dim sQuery1 As String = "SELECT CardNo FROM Cards WHERE CardType = 'TMP'"
Dim sQuery2 As String = "SELECT TmpCardNo FROM Cards WHERE TmpCardNo <> ''"
Dim dsTempCard As New DataSet
Dim arrRslt As New ArrayList
If Not (fTempCard.SQL.ExecuteSQLTable(sQuery1, dsTempCard) And fTempCard.SQL.ExecuteSQLQuery(sQuery2, arrRslt)) Then
MsgBox("Unable to load temp card from database.")
LOG.WriteErrLog(0, "frmTemp_SelCard - LoadTempCards : Failed to load temp card <" & sQuery1 & "> <" & sQuery2 & ">")
Exit Sub
End If
With dsTempCard.Tables(0)
If .Rows.Count > 0 Then
For iCnt As Integer = 0 To .Rows.Count - 1
If arrRslt.IndexOf(.Rows(iCnt).Item(0).ToString.Trim & ",") < 0 Then
.Rows(iCnt).Item(0) = .Rows(iCnt).Item(0).ToString.Trim
Else
.Rows.Remove(.Rows(iCnt))
iCnt -= 1
End If
If iCnt = .Rows.Count - 1 Then
Exit For
End If
Next
End If
End With
dgvSel_Card.DataSource = dsTempCard.Tables(0)
Catch ex As Exception
LOG.WriteErrLog(0, "frmTemp_SelCard - LoadTempCards : " & ex.Message)
End Try
End Sub