Hi mate,
I'm new too so maybe this isn't the best way or totally
correct but i think...
your SQL query will only give you the first selected item of
your listbox.
sql = "SELECT mobile_num FROM STUDENT WHERE pem_grp = '" &
listbox.SelectedItem.Text & "' "
you could rewrite your SQL query to be something like:
"select the mobile_num from student where pem_grp in 'string1',
'string2', 'string3' " etc (checkout the 'in' syntax under SQL
select statements)
this would select records where pem_grp was values 'string1',
'string2' or 'string3'. You would have to write some code to
build this 'on-the-fly' depending on how your user ticked the
listbox selections.
As far as manipulating the records once you've selected them, I
would read you records into a dataset. You can then loop through
the dataset looking at various records and take action
accordingly:
eg
dim aTotalSmiths as integer = 0
for i = 0 to myDataset.tables("mytable").rows.count-1
if myDataset.tables("mytable").rows(i).item("name")=" smith" then
aTotalSmiths += 1
end if
next
the above loops through the dataset counting up all guys whose
name is 'smith'. you could also change the datafield eg
if myDataset.tables("mytable").rows(i).item("name")=" smith" then
myDataset.tables("mytable").rows(i).item("name") = "Mr Smith"
end if
Hope some of this helps. If its too dumb then apologies.
If someone else knows a better way then I wont be offended.
Best of luck
Chas. (Canterbury, UK)
|