1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30
| using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Data.SqlClient;
namespace memoire
{
public partial class frequentation : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
DropDownList1.Items.GetEnumerator();
String con = "Data source=localhost;Initial catalog=concours;uid=mwizero;pwd=mwizero";
SqlConnection connection = new SqlConnection(con);
String req = " select idcandidat,Code_candidat,Nom_candidat,Prenom_candidat from candidat ";
connection.Open();
SqlCommand reqcom = new SqlCommand(req, connection);
SqlDataReader der = reqcom.ExecuteReader();
while (der.Read())
DropDownList1.Items.Add(der.GetInt32(0).ToString() + "- " + der.GetString(1) + " -" + der.GetString(2) + " -" + der.GetString(3));
connection.Close();
} |
Partager