this is the code that i used, works good but can anyone take look & tell me is there any thing that i could change
code DAL.cs :
public DataTable villelist()
{
DataTable tbl = null;
SqlConnection conn = Conection.GetDbConnection();
SqlCommand cmd = new SqlCommand("BindVilleList", conn);
cmd.CommandType = CommandType.StoredProcedure;
conn.Open();
tbl = new DataTable();
SqlDataReader dr = cmd.ExecuteReader();
tbl.Load(dr);
dr.Close();
dr.Dispose();
return tbl;
}
code BLL.cs :
public DataTable villelist()
{
return userDAL.villelist();
}
code default.aspx :
<pre lang="cs">protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
DataTable dtl = null;
dtl = userBLL.villelist();
ddlVillle.DataSource = dtl;
ddlVillle.DataTextField = "Nom_ville";
ddlVillle.DataValueField = "Id_vll";
ddlVillle.DataBind();
}
}
}