Hi You Must try this
Protected Sub DropDownList1_SelectedIndexChanged()
con=new sqlcnnection(constr)
adpt=new sqldataadapter("select dept_code from T.N. where dept_name='"+dropdownlist1.selecteditem+"'",con)
ds=new dataset
adpt.fill(ds,"T.N.")
dim i as string=ds.tables(0).rows(0).item(0)
dropdownlist2.item.clear()
dropdownlist2.item.add(i)
End Sub
Last edited by Narue; Jan 5th, 2009 at 9:30 am. Reason: added code tags