protected void Submit_Click(object sender, EventArgs e)
{
string cname1;
string selectSQL =
"SELECT candidate.Name as cName, IDGroupe, "
+ "ExamName, groupTab.Name as gName "
+ "FROM candidate INNER JOIN groupTab ON "
+ "[groupTab].ID = candidate.IDGroupe "
+ "WHERE candidate.ID = "
+ "@ID";
SqlConnection con = new SqlConnection(connectionString);
SqlCommand cmd = new SqlCommand(selectSQL, con);
cmd.Parameters.AddWithValue("@ID", HiddenField1.Value);
SqlDataReader reader;
try
{
con.Open();
reader = cmd.ExecuteReader();
if (reader.Read())
{
if (reader.GetString(0) != null)
{
cname1 = reader.GetString(0);
**CName.Text = cname1;**
}
}
reader.Close();
}
catch (Exception err)
{
lblResult.Text = "Error reading list of names";
lblResult.Text += err.Message;
}
finally
{
con.Close();
}
}
谢谢, Hadil