Det beror ju på vad du vill. Är det ren prestand du är ute efter så är det en SqlDataReader som hämtar datan och binder det sedan till en repeater. Bättre prestanda än så får du inte..
Den är dock inte så användarvänlig, och du får inga fina funktioner på köpet.
Så vänd på frågan och säg, vad vill jag ha, och sedan ta den som passar dina krav.
Varken ObjectDataSource eller SqlDataSource är "uppkopplingar" mot databasen (SqlConnection är en "uppkoppling"). De är kontroller som hjälper till med hämtning och uppdatering av databasen (eller i fallet med ObjectDataSource, uppdatering av affärsobjekten).
Det finns många åsikter om dessa kontroller, i synnerhet SqlDataSource, men de kan vara smidiga om man vill byhgga något enkelt och snabbt. Till mer avancerade, komplexa lösningar tycker inte jag att SqlDataSource passar alls.
For example, I just timed myself. By using the SqlDataSource control with the GridView control, I was able to build a page that displays the contents of the Northwind Products database table in 1 minute and 15 seconds (It's not pretty, but it does display the data). Wow, that's fast!
However, there is one problem with the SqlDataSource control. If you use the SqlDataSource control, then you are doing something bad. The SqlDataSource control is bad since the control forces you to jumble together your user interface layer with your business logic layer. Mixing layers, as any application architect will tell you, is just shameful.
When building a proper multi-tier Web application, you should have distinct user interface, business logic, and data access layers. Referring to SQL statements or stored procedures in the user interface layer, as the SqlDataSource control forces you to do, is just plain wrong.
Ok, kontroll då...
Tanken är att jag vill ha en kontroll som innehåller uppdatering osv men samtidigt erbjuder en dynakik så att man hyfsat enkelt kan göra egna classer som jobbar mot den.
Senast så pyslade jag lite med objectDataSource men den hamnade inte direkt bland favoriterna.
259 ms totalt · 4 externa anrop · v20260731065814-full.a51de22e