Hello again,
I have a method:
public static void GetStudents(DropDownList list, Label lbl)
{
SqlConnection conn = new SqlConnection(Config.DbConnectionString);
SqlCommand cmd = new SqlCommand("GetStudentsToDDL", conn);
cmd.CommandType = CommandType.StoredProcedure;
SqlDataReader reader;
try
{
conn.Open();
reader = cmd.ExecuteReader();
while (reader.Read())
{
ListItem item = new ListItem();
item.Text = reader["StudentName"].ToString() + " " + reader["StudentFamilyname"].ToString();
item.Value = reader["StudentID"].ToString();
list.Items.Add(item);
}
reader.Close();
}
catch (Exception ex)
{
lbl.Text = ex.Message;
Utilities.LogError(ex);
throw;
}
finally
{
conn.Close();
}
}
ddlStudents.DataSource = CatalogAccess.GetStudents(ddlStudents, lbl);
ddlStudents.DataBind();
Says: Error 3 Cannot implicitly convert type 'void' to 'object'
Where's the problem?