Link to home
Start Free TrialLog in
Avatar of venterm
venterm

asked on

populate dropdownlist with datareader

Hi there,

I am having a problem with populating a dropdownlist. The code is as follows :


            myConnection = New SqlConnection ("server=slserver;uid=;pwd=;database=meta_dev")
            SQL$ = ""
            SQL$ = SQL$ & " select      glpd_key      "
            SQL$ = SQL$ & " from        gl_period   "
            myConnection.Open()
            myCommand = New SqlCommand(SQL$, myConnection)
            myDataReader = myCommand.ExecuteReader()
            Me.ddl_glperiod.DataSource = myDataReader
            Me.ddl_glperiod.DataBind()
            'close connection to item_map_gl
            myConnection.Close()

        ddl_glperiod.SelectedIndex = 15
           
When the page load - it populates the dropdownlist with System.Data.Com.... If i debug the code, there is no errors.

Can someone help please ....

Thanks
ASKER CERTIFIED SOLUTION
Avatar of TimCottee
TimCottee
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial