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
|
protected void Page_Load(object sender, EventArgs e)
{
String CString = "Data Source=.\\SQLEXPRESS;AttachDbFilename=C:\\www\\biblio\\App_Data\\bibliotheque.mdf;Integrated Security=True;Connect Timeout=30;User Instance=True";
SqlConnection Conn = new SqlConnection(CString);
Conn.Open();
string SqlString = "SELECT * FROM [APARTIENT] WHERE ID_ENSEINANT = " + Request.Params["Enseignant"];
SqlCommand Comm = new SqlCommand(SqlString, Conn);
SqlDataReader dread = Comm.ExecuteReader();
while (dread.Read())
{
object i = dread[1];
int j;
j = (int)i;
Label1.Text = j.ToString();
for (int k = 0; k < ChblDepartement.Items.Count; k++)
{
if (ChblDepartement.Items[k].Value.ToString().Equals(j.ToString()))
{
ChblDepartement.Items[k].Selected = true;
}
}
}
} |
Partager