19-02-24, 03:44 AM
كود :
Dim CheckedIndexes As New ArrayList
Dim CheckedIds As New ArrayList
Dim i As Integer
For Each item As String In CheckedListBox1.CheckedIndices
CheckedIndexes.Add(item)
Next
For i = 0 To CheckedIndexes.Count - 1
CheckedListBox1.SelectedItems.Clear()
CheckedListBox1.SelectedIndex = CheckedIndexes.Item(i)
CheckedIds.Add(CheckedListBox1.SelectedValue)
cond += " and Inv_Sub.group_NO=" & CheckedListBox1.SelectedValue
Next
CheckedListBox1.SelectedItems.Clear()
End Ifعندما يتم تحديد أكثر من اختيار فى CheckedListBox1 تعود قيمة البحث باكثر من قيمة لل SelectedValue لل لحقل group_NO مثلا 160 و 161 و162 ممكن اكثر او اقل
المطلوب تعديل الشرط
cond += " and Inv_Sub.group_NO=" & CheckedListBox1.SelectedValue
بحيث يكون
الشرط هو تحديد كل السجلات التى يكون فيها حقل ال group_NO يساوى 160 أو 161 أو 162 مثلا وذلك على حسب القيمة
جملة الاستعلام المستخدمة
كود :
Dim da As New SqlDataAdapter("select Inv.safe,Inv.proc_type,date,Inv.id,inv.reg ,currency_from,val1,exchange_price,(val1*exchange_price)as sum,sales_emp " & _
" from Inv,Inv_Sub where " & CondBranch & ClientSqlStr & " date>=@date1 and date<=@date2 and Inv.proc_id=Inv_Sub.proc_id and Inv_Sub.proc_type=" & _type & " and Inv.IS_Deleted=0 " & cond & " order by date", conn)