Monday, July 18, 2011

Database woes

Now that the project is created, I need to connect it with a database. The tutorial template comes with an mdb file, which I can use to create the database.

I selected app->data and tried to create a database by selecting the mdb file which came with the tutorial. However, I was not able to create the database. I got an error message which said that SQL Server 2005 Express or 2008 Express should be installed. I thought that VisualStudio 2010 came with SQL Server 2008 Express... oh well...

I downloaded SQLServer 2008 Express with Tools and
tried to install it. The installation exited with an error message because .NET 3.5 SP2 was not installed. I think I must have uninstalled it when I removed all instances of SQL Server from my system.

Installing .NET 4.0 now... installed.
Ran the SQL Server installer again, but I get the same error. Looks like it either works only with .NET 3.5 or maybe .NET 4.0 does not have something which .NET 3.5 has. A Google search revealed this post, which suggests that the .NET 4.0 client profile may not be good enough... we might need to install the whole deal (whatever that is...)

I am a bit irritated with this whole dependen
cy nonsense... MS you really need to get your act together.

I am now installing .NET 3.5 with SP1. I hope it does not conflict with the .NET 4.0 I already have installed on my system. Hopefully, I will be able to install SQL Server after .NET 3.5 .

Now, I have .NET 2.0, 3.5 SP1, and 4.0 all installed on my machine. SQL Server dost thou needest anything more ?

Running SQL Server 2008 express installer again. This time I ran into an application error related to landingpage.exe which is described very well on this page. As suggested, I deleted the Microsoft_Corporation folder.

This time the installation failed because Windows Power Shell was not installed, and apparently it is a pre-requisite for SQL Server 2008 Express. Oh well and on we go... trying to get Windows Power Shell.

Installed Windows Power Shell 1.0 ... re-running the SQLServer rules

At some point in the installation (server configuration) I got an error message which said that the credentials I have provided are not valid. I have not provided any credentials. Some Googling suggested that there is a drop down list in the username section. We should select any item and make sure there is no password. Did that and it worked. Account names are as follows:

SQL Server Database Engine : NT AUTHORITY\SYSTEM
SQL Server Browser NT AUTHORITY\LOCAL SERVICE

Selecting mixed mode for authentication (SQL Server Authentication and Windows Authentication)

Finally SQL Server is installed. I CANNOT BELIEVE THIS!

Next, I went back to the project, right clicked on 'App_Data', and selected the mdf file for this lab from the downloaded tutorial labs. It seemed to have accepted the mdf and looks like things are moving ahead.

Just to verify, I double clicked on the database, which opened the database viewer. The database shows several Event Application related tables, as shown in the image below.



Create The Entity Data Model:
Since we want to be able to access the server side Entities in the Silverlight client, we need to create the Entity Data Model. I right clicked on the Eventer2.Web node in the Solution Explorer. Then I selected C#->Data and selected 'ADO.NET Entity Data Model'. I set the name to 'EventManagerDBModel', and then in a later wizard screen, specified that the model needs to be created from an existing database (SEventManager.mdf). Clicking on Finish, finally showed me the data model for the application.

Next, I rebuild the project, because without that the EDM we just created would not be available to RIA services link.


No comments:

Post a Comment