Please support our ASP.NET advertiser: Lunarpages ASP Web Hosting
Views: 3282 | Replies: 2
![]() |
hi
recently, i realise theres such thing as Hashtable that are allow listbox to retrieve url when clicked. However, as i find out more, i realise most examples i saw are static. As in
is there any way to retrieve this list from database instead of coding it like that?
i tried doing so, but it gave me a "Public member 'DataSource' on type 'Hashtable' not found." error.
can anyone guide me on this?
thanks a lot
recently, i realise theres such thing as Hashtable that are allow listbox to retrieve url when clicked. However, as i find out more, i realise most examples i saw are static. As in
dim mycountries=New Hashtable
mycountries.Add("N","Norway")
mycountries.Add("S","Sweden")
mycountries.Add("F","France")
mycountries.Add("I","Italy")is there any way to retrieve this list from database instead of coding it like that?
i tried doing so, but it gave me a "Public member 'DataSource' on type 'Hashtable' not found." error.
cmdSelect = New OdbcCommand( "SELECT IMG_TITLE, IMG_LINK FROM worklist", conODBC)
DApt.selectCommand = cmdSelect
DApt.Fill(dsSet, "worklist")
Dim linkrd = new Hashtable
linkrd.DataSource = dsSet.Tables("worklist")
linkrd.DataBind()
linklist.DataSource = linkrd
linklist.DataTextField="img_title"
linklist.DataValueField="img_link"
linklist.DataBind()can anyone guide me on this?
thanks a lot
You almost have it, use "Key", or "Value" for datasource assignment and a DataReader to populate values from database query...
PS: I'm not a VB developer so if I got something mixed up, I'm sure you'll figure it out.
Dim linkrd = New HashTable() While reader.Read() linkrd.Add(reader.GetString(0), reader.GetString(1)) End While linklist.DataSource = linkrd linklist.DataTextField = "Value" linklist.DataValueField = "Key" linklist.DataBind()
PS: I'm not a VB developer so if I got something mixed up, I'm sure you'll figure it out.
![]() |
•
•
•
•
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)





Linear Mode