ASP.Net ITM 4/563 - Week #10
•
•
This Week • pubs sample database • Available on site under homework link • AdventureWorks Sample Database • AdventureWorksLT • http://www.codeplex.com/MSFTDBProdSamples/Release/ProjectReleases.as px?ReleaseId=4004 • Release Notes • http://www.codeplex.com/SqlServerSamples/Wiki/View.aspx?title=SQLServ erDatabasesandSamplesOverview&referringTitle=Home • exec sp_attach_db @dbname = N'AdventureWorks', @filename1 = N'C:\Program Files\Microsoft SQL Server\MSSQL.1\MSSQL\Data\AdventureWorksLT_Data.mdf', @filename2 = N'C:\Program Files\Microsoft SQL Server\MSSQL.1\MSSQL\Data\AdventureWorksLT_log.ldf' • SqlDataSource • Creating a connection to a datasource • Pros • Can tie to many datasource types (not just SQL) • SQL, ODBC, OLEDB, etc • Simple to use and setup • Great for simple, single-page, low traffic environments • Quick fixes, prototypes • Cons • SQL within ASPX page • NOT able to tie to a business layer object • We will need to use the ObjectDataSource for this method (and we will in the coming weeks). • Not very scalable • Cannot share between developers • Logic must be recreated on each page (if you are going to use this on more than one page). • Using the SqlDataSource • Drag onto Form • Create Connection to Datasource • SELECT only • All CRUD methods • Review ASPX • Using with GridView • Examples • Titles, Styles, Paging, Sorting, Editing (Update, Delete) etc. • Insert - How do we do it? • Investigate • DetailsView • How to associate with a GridView? • Investigate Homework • Will be available by tomorrow evening OR there will be no homework.