jesper

jesper

  • NA
  • 89
  • 54.2k

SQLDatareader select top from database and show on webform

Feb 6 2013 9:00 AM
I have a connection class with this content:

 public class Dal
    {
        public SqlConnection connection()
        {
            SqlConnection conn = new SqlConnection(@"Data Source=.\SQLEXPRESS;Database=Manager_db; Integrated Security=true;");
            return conn;
        }
    }

in another class i have the method to select colums from my database:

        public SqlDataReader fillrecentchanges()
        {
            SqlConnection conn = databaseobj.connection();
            conn.Open();

            SqlCommand cmd = new SqlCommand(@"SELECT TOP 3 FROM Manager_tb", conn);
            SqlDataReader rdr = cmd.ExecuteReader();

            return rdr;
        }


How do i list the 3 first entry in a webform under each other without columnames?

// Jesper

Answers (2)