2
Answers

SQLDatareader select top from database and show on webform

Photo of jesper

jesper

12y
2.4k
1
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)