1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
| protected void Page_Load(object sender, EventArgs e)
{
string cstring = @"data source=.\SQL2005; database= App_Data\Databasert; integrated security= true";
SqlConnection cx_annuaire = new SqlConnection(cstring);
string rq = "select lil from test";
SqlCommand sql = new SqlCommand(rq, cx_annuaire);
cx_annuaire.Open(); erreur ici, pas de connection a la bd
SqlDataReader reader = sql.ExecuteReader();
DropDownList1.DataSource = reader;
DropDownList1.DataTextField = "lil";
DropDownList1.DataBind();
} |
Partager