shahab
Junior Contributor
I use this code for DropDownList DataBind:
void BindDDL()
{
try
{
string strCon = ConfigurationSettings.AppSettings["ConnStr"];
SqlConnection wg = new SqlConnection(strCon);
SqlDataAdapter dtAdap1 = new
SqlDataAdapter("select Username from tblUserAccounts",wg);
dtAdap1.Fill(dsDDL, "tblUserAccounts");
DropDownList1.DataBind();
}
catch (Exception DDLError)
{
Label8.Text=DDLError.Message.ToString();
}
}
But it does not shows the usernames!
void BindDDL()
{
try
{
string strCon = ConfigurationSettings.AppSettings["ConnStr"];
SqlConnection wg = new SqlConnection(strCon);
SqlDataAdapter dtAdap1 = new
SqlDataAdapter("select Username from tblUserAccounts",wg);
dtAdap1.Fill(dsDDL, "tblUserAccounts");
DropDownList1.DataBind();
}
catch (Exception DDLError)
{
Label8.Text=DDLError.Message.ToString();
}
}
But it does not shows the usernames!