if the query below returns zero rows, then shouldn't the objDR.read = false? The reason I ask this is becasue I know that no rows are being returned but it still goes into the Do while loop?
VB Code:
sqlCmd = "select employee_last_name,employee_first_name,employee_id from pcms.pcms_pcard where employee_work_unit='" & CmbWorkUnit.Text & "' and status_ind='A' order by employee_last_name" Dim objCom As New OleDbCommand(sqlCmd, objCon) Try objCon.Open() objDR = objCom.ExecuteReader Do While objDR.Read = True Me.CmbCards.Items.Add(Trim(objDR("employee_first_name")) & " " & (Trim(objDR("employee_last_name")) & " " & (Trim(objDR("employee_id"))))) Loop objDR.Close() Catch ex As Exception MsgBox("Credit Card fill error: " & Err.Description) Finally objCon.Close() End Try




Reply With Quote