Tips and Tricks in a world of Mix

Posts tagged ‘mdf’

Asp.Net MVC5 build a website DB mdf(local) first

I’ve created some time ago a local MDF file with a bunch of tables for use. So now I want to get back to it and implement it through the edmx Ado.Net template

untitled-picture1

After I’ve added the mdf local db file to the App_DATA folder I can now connect it to the automatic created scheme like this –

untitled-picture2I will go through the wizard and choose the objects of tables to recreate at the edmx model

At the end I will have the objects created with C# from DB for me by this automatic process.

untitled-picture3

Rebuild your solution to make everything checked and ready to go!

I am adding a controller

untitled-picture4

By description I want the scaffold to build everything for me – including the view representation of my objects.

untitled-picture5

Choosing the entity to render

untitled-picture6

After a lot of thinking on his part I am getting new files in the solution folders structure

untitled-picture7

That’s it.

Modell .edmx 
Modell Context.tt 
Modell .Context.cs 
Modell Designer.cs 
Modell .edmx.diagram 
Modell .tt 
A dress.cs 
Event.cs 
Events EventDetaiIs.cs 
EventType.cs 
LocationDetaiI.cs 
Modell 
Place.cs 
PlaceForm.cs 
PlaceScope.cs 
SocialNetwork.cs 
sysdiagram.cs 
User.cs 
UserFriend.cs 
Users UserDetaiIs.cs 
Users_UserSecurity.cs 
WorkDetaiI.cs

This slideshow requires JavaScript.

Database (mdf ) cannot be opened due to inaccessible files/insufficient memory/disk space.

 

If the database is inaccessible and received the error mentioned below through MSSQL Server Management studio:

Please follow the steps mentioned below:
1. Make sure that the Windows server has got enough disk space.
2. If the disk space is ok, then login to the MSSQL Server Management studio.
3. Select the particular database and right click on it. Click on "Detach" option to detach the database from the MSSQL management studio.
(Before that make sure that you have the backup of the database or a MDF file)
4. The database will be removed.
5. Click on Databases, right click on it and select the option of "Attach".
6. Click on Add to attach the MDF file of the database.
7. Click Ok.

Failure in starting the process for the user instance

Problem –
Trying to open MDF file getting –
“Failed to generate a user instance of SQL Server due to a failure in starting the process for the user instance. The connection will be closed. ” 

Answer –

In Server Explorer . Right click the MDF file .
Click modify connection.
On the Advanced Tab of the modify connection, scroll down and look for ‘User Instance’ property. Set to ‘False’.

Same thing if you are creating a new instance of MDF .
After creation make the modification described above.

Tag Cloud

%d bloggers like this: