hi,
i have a function called ViewComments() which retrieve contents from database using SQL commands
private void ViewComments()
{
hookUp = new SqlConnection("Server=XXXX\\SQLEXPRESS;Database=WebExcerciseDB;" + "Integrated Security=True");
SqlCmd = new SqlCommand("SELECT PersonName,PersonMail,Comment FROM CommentsTable", hookUp);
try
{
hookUp.Open();
reader = SqlCmd.ExecuteReader();
while (reader.Read())
{
SQL_Result.Text += reader["PersonName"] + " " + reader["PersonMail"] + " " + reader["Comment"] + Convert.ToString(reader["PostDate"]) + "<br/>";
}
}
catch (Exception)
{
MessageBox.Show("Error in database code\n");
}
finally
{
reader.Close();
hookUp.Close();
}
}
i want to store the contents in IList<>
control, how to do that?
thanks any way..