Connecting to SQL 2005
Two days on this issue, probably easy one but hard stuff for an average developer like me!
Sadly a proof that you can’t really depend on .Net 2.0 books yet. I believe the lack of experience from many means we have to survive only with Scott Guthrie and his team.
Anyway what happens here make sense when you finally see the light but at the start it baffled me for too much precious little hours.
First I installed SQL 2005, then VS 2005 without SQL Express 2005. Then I run in a lot of problems trying to setup the Membership provider correctly and make it working with SQL 2005. I am lucky enough to have on my bookshelf 99% of the ASP.Net 2.0 litterature but found nothing on the subject.
All the time when I was trying to setup some users with the Web admin Tool, always the same message ‘Unable to access the datastore’.
The solution is not that easy. I try to create a datasource and bind it to a web control, everything is OK. So it’s not a bad connection string.
Finally I decided to go through all the recent Scott’s posts and I discover this gem ! The trick is that ASP.Net 2.0 is setup by default to talk to SQL Express (why oh why the setup can’t modify automatically this behavior I don’t know??). So Scott give the easy solution which is to create a connection string in your config file using LocalSqlServer as the name and then to link the data source to your local SQL 2005 Db.
I wish to have this fix in a service pack. One thing I don’t understand. To use the ASP.Net configuration MMC snap in you need to have IIS installed. I know you can use VS 2005 without IIS, so how in this case do you reach the snap in?