views:

25

answers:

2

I need to set up ASP.NET and connect it to some demo (northwind) data.

Considering all the versions of SQL, what is the most current /efficient way to get a database into a project and do a select against it?

This question arose once we discovered we could download a MDB and a MDF format of northwind...

+2  A: 

asp.net is loaded with tons of how to's for started. One section specifically goes into the different ways of interacting with a database. I choose the old fashion DAL which they outline at http://www.asp.net/data-access/tutorials/creating-a-data-access-layer-cs.

There are now plenty of new ways using LINQ and other methods, but u can look at all the options yourself.

Anthony Greco
I would strongly recommend against using any form of Data Set/Tables, these are an abomination to OOD.
Chris Marisic
That definitely is a personal preference, as I *LOVE* my DAL. Makes my coding life 100 times easier, and can't be that bad if it's still listed as the first articles on ASP.net for Data Access. As I said though, there are tons of more up to date ways not to do it, such as using an ADO.NET Entity Data Model, LINQ to SQL, or simply sending SQL statements yourself and handling them. The 3rd I really do not suggest as you got to make sure then to look out for SQL injections, using the other methods you usually are good out of the box.
Anthony Greco
Is creating a "DataSet" the only way? I'm just essentially taking a SQL DB and dumping it to a 3rd party control that is of Object. Anything more simple?
MakerOfThings7
You can actually bind to the control via actual SQL data. Here is an example of binding SQL to a datagrid [http://msdn.microsoft.com/en-us/library/aa719634%28VS.71%29.aspx]. To find more simply search for "asp.net databind sql" or something to the sort. In the end, it actually generates a dataset though to databind to the control.
Anthony Greco
A: 

If you have an existing SQL Server installation, use that, otherwise install SQL Express and drop the mdf file into your App_Data folder.

You can then use what ever data access method you prefer. eg ADO.Net, Linq to sql, Entity Framework etc.

geoff