Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Dropdown list not populating..

Status
Not open for further replies.

sd110404

Programmer
Nov 3, 2004
63
US
Hi All,

Can someone point out where I am wrong? I tried all sorts of debug, replaced with array to populate in my drop down and all works fine, except my below code.

Code:
DataTable dt = new DataTable();
dt = dataMyClient.GetAccountOwnerList(usrname);

DropDownList.DataSource = dt;
DropDownList.DataTextField = "name";
DropDownList.DataValueField = "EmployeeID";
DropDownList.DataBind();

Code:
public DataTable GetAccountOwnerList(string username)
        {
            DataTable dt = new DataTable();
            try
            {
                m_Adapter = new SqlDataAdapter(SQLStatement.SELECT_ACCOUNT_OWNER.Replace("@username", username), m_Connection);
                m_Adapter.Fill(dt);
            }
            catch (Exception ex)
            {
            }
            return dt;
        }

SELECT_ACCOUNT_OWNER = Select statement

Could someone tell me why the above code not working? Where am I wrong.
Thank you!
 
your swallowing the exception. remove the try/catch to find out what went wrong.

Jason Meckley
Programmer
Specialty Bakers, Inc.
 
As Jmeckley stated, you can remove the exception, or put a breakpoint on the starting point and step through the code and examine ex.

If this is an ASP.Net app, do you have AutoPostback set?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top