vb.net - Compare array with SQl table -
for each connection in array called allconn, compare sql table. if exist, add listview. here code below, not seem work:
dim loginfilter object dim selcurrallsessions sqlclient.sqlcommand = new sqlclient.sqlcommand("select * currallsessions", lfcnn) selcurrallsessions.commandtype = commandtype.text loginfilter = selcurrallsessions.executereader each conn in allconn while loginfilter.read() if conn.username.tostring() = loginfilter.item(0) listbox1.items.add(loginfilter.item(0)) end if end while next
well need change order of loops
while loginfilter.read() each conn in allconn if conn.username.tostring() = loginfilter.item(0).tostring listbox1.items.add(loginfilter.item(0).tostring) exit end if next end while
this necessary because in original code, internal while run till end of data loaded database then, when try check next conn, cannot reposition reader @ start of data loaded database.
Comments
Post a Comment