when want select hotel name want assign each hotel name number of room has
sqlcmd1 = "select roid room" ad = new oledb.oledbdataadapter(sqlcmd1, cnn) ds = new dataset ad.fill(ds, "room") each row datarow in ds.tables(0).rows roomcb.items.add(row.item(0)) next
this combobox hotel
private sub hotelcb_selectedindexchanged(sender object, e eventargs) handles hotelcb.selectedindexchanged if (hotelcb.selectedindex = 0) sqlcmd1 = "select roid room" ad = new oledb.oledbdataadapter(sqlcmd1, cnn) ds = new dataset ad.fill(ds, "room id") roomcb.datasource = ds.tables(0).defaultview elseif (hotelcb.selectedindex = 1) sqlcmd1 = "select roid room hotelid=" + hotelcb.selectedindex.tostring() ad = new oledb.oledbdataadapter(sqlcmd1, cnn) ds = new dataset ad.fill(ds, "room id") roomcb.datasource = ds.tables(0).defaultview end if end sub
you have specifiy displaymember
:
roomcb.displaymember = "roid"; roomcb.valuemember = "roid"; roomcb.datasource = ds.tables(0)
Comments
Post a Comment