SQL Server 2008 user instance database creation failure within an asp.net project - asp.net

I'm trying to create a database within the app_data folder of an asp.net mvc project using the IDE, but i am getting a "Required Components Missing" message indicating "Connections to SQL Server files (*.mdf) requireSQL Express 2005 ....."
I am using
- Windows 7 Enterprise
- VS2008 Team System SP1
- SQL Server 2008 Developer Edition SP1
I have altered the database connection to use the default instance by setting to blank using
Tools -> Options -> Database Tools -> Data Connection : SQL Server Instance Name
I also note from the SQL Server Books Online that the user instance feature will be removed in the future, but for now it suits my effort in developing an application where a number of people are working on the project.
Has anyone managed to create a database in the same manner?
It appears Nerd Dinner has done so

The attached user-instance database in the App_Data will work only with a SQL Server Express edition - 2005 or 2008.
It does not work with a full SQL Server edition, like Web, Workgroup, Standard, Enterprise or Developer. It does not - no way - no trick to make it work - does not - period.
If you want to use that mechanism of attaching a user instance database in your App_Data folder, you must use SQL Server 2005/2008 Express.

Related

Publish ASP.NET MVC 4 (Razor) app onto remote server running Windows 7 with IIS 7

I have experience in hosting an Asp mvc 4 application on local IIS with Sql server as back end. Now I want to host this application on another system that don't have Sql server and Visual studio installed. I think we can able to get all files necessary to host by publish option in visual studio 2012. But I don't have any idea on how to make my database working on the server without sql server and the necessary connection strings. Can I change my db to sql server compact 4.0?
Please give the necessary instructions.
For .net Application you can generate necessary files using publish feature of VS.You can even make use of web-deploy for direct deployment of artifacts to remote server itself.
For db you better have sql -engine, without that it get's tricky. Express edition will always be better option if you are not looking for some advanced DBA jobs.

How to know if Entity was using SQL Server or not?

I have followed through a tutorial using a "Code First" approach with Entity framework. It seems like Visual Studio was smart enough to create the database for me and setup the tables and everything based on my classes. I have a question about the database that was created.
I notice that the database was automatically set up and I could see it in my Server Explorer window in Visual Studio. In my Web.config, under the connection string, I see Data Source=(localdb)\v11.0;.... There is also a .mdf file created in a folder called App_Data.
My question is:
Was Entity framework using MS SQL Server or SQL Express for the database it has created?
If it wasn't using MS SQL Server or SQL Express, what was the database that Entity used?
I don't remember installing SQL Server or SQL Express. Does installing Visual Studio automatically install MS SQL Server or SQL Server Express?
PS: I will appreciate if you can help me to clear up my doubts. Coming from a PHP background, I'm very new to .NET and its ecosystem.
The connection string indicate that you are using SQL Server Local DB.
With Microsoft SQL Server 2012, Microsoft has introduced a feature called LocalDB which is a new edition of SQL Express. LocalDB is created specifically for developers and it is much easier to install (no service) and manage than standard editions. Developers initiate a connection by using a special connection string. It supports AttachDbFileName property, which allows you to specify a database file location.
When connecting, the server is automatically created and started, enabling the application to use the database without complex configuration tasks. This edition uses the same sqlservr.exe as the regular SQL Express and other editions of SQL Server.
http://msdn.microsoft.com/en-US/evalcenter/dn434042.aspx
http://technet.microsoft.com/en-us/library/hh212961.aspx

SQL Server Express and SQL Server Compact Edition

I've just built my first Umbraco site and now I want to hand it over for deployment on a web server. However, I built the site on my local machine using Web Matrix, which uses a SQL Server Compact Edition database, which is represented in a .sdf file.
I was a bit uneasy about whether this would be much use to the person I'm passing the site to (they have a number of Umbraco based sites running on this server using SQL Server) - so I installed SQL Server Express and migrated the database from Compact Edition to Express. However (again), I can't seem to find any way of exporting the full database to a file which can then by imported into a database on the web server.
A couple of points I guess - first, is the Compact Edition .sdf file actually enough for someone to take and import a database into SQL Server Standard? Failing that, how would I export the database from SQL Server Express to a file which could be used for this purpose?
Thanks in advance - this is my first foray into .net development so I'm grateful for any help!
You could just give the SQL CE database (.sdf) to the person who manages the web server. The SQL CE database can be run by default on a .NET webserver.
If, for some reason, you want to migrate it to SQL Server, you can do this through Web Matrix (http://www.microsoft.com/web/)
When you have already converted the SQL CE database to SQL Server, you can:
make a backup through the SQL Server Management Studio tool and restore the backup on the web server
or you can use the SQL Server Management Studio tool to script the database to a .sql file which can be executed on the web server
I prefer the first option.

ASP.NET User/Role Management in VS2010 - skipping over the SQL Express version and going straight to SQL Server 2008 R2

As I'm learning the ins and outs of ASP.NET user management, I've learned that the default in VS is for it to use a SQL Server Express .mdf file for the data it needs to save. This won't help me for when I deploy my site, as I'm running SQL Server 2008 R2 on my IIS 7.5 server. I know that I can run a command line tool to automatically create the db tables necessary for user management, and will do that on my development machine, but how do I tell my existing, in development code in VS to ignore the existing Express .mdf file and look at the newly created db tables?
Simply update your Web.Config to set up the role provider and the database connection string:
http://weblogs.asp.net/scottgu/archive/2006/11/20/common-gotcha-don-t-forget-to-clear-when-adding-providers.aspx
http://www.codersbarn.com/post/2008/02/24/ASPNET-20-Guest-Book-Admin-Part-II.aspx
Also, Scott Mitchell's Membership and Roles tutorial series is the most comprehensive I've seen:
http://weblogs.asp.net/scottgu/archive/2006/05/07/ASP.NET-2.0-Membership-and-Roles-Tutorial-Series.aspx

How do I create my first database for .NET development?

Ok! I'm ready to embark on some .NET development for the first time.
I've recently installed Microsoft Visual Studio which included Microsoft SQL Sever 2005.
What is the prefered method for programming against a development database? I want to write an ASP.NET application that uses a database and I'm not sure how to create one. In my start menu for SQL Server 2005 all I have is:
SQL Server Configuration Manager
SQL Server Error and Usage Reports
SQL Server Surface Area Config
I don't see an intuitive program to create and design databases on that list, so how do I do it?! Will I be creating a full fledged SQL Server database or a "flat-file" fake database to program against?
Can someone please tell me what is up on creating my first MS SQL Server 2005 database?
If you've Visual Studio, just goto server explorer, Add a new database connection to your database, and start off.
Or, create a new website project in Visual studio, right click the App_Data folder->Add New Item and add a SQL Server database mdf file, which will be attached to the sql server when you run the app. You need to deploy the mdf file when doing a production release :)
You might want to watch the videos in ASP.NET website http://www.asp.net/learn/
Otherwise, consider using Microsoft SQL Server Management Studio (an express edition is also available).
You are looking for Microsoft SQL Server Management Studio Express. Its pretty easy to add a database once you get your head around it.
To be clear, the SQL Server included with Visual Studio is an express edition. However, the one thing it is lacking is the SQL Server Management Studio (Express). I'd download and install the express edition that included the management studio (note that VS 2005 and 2008 include SQL Express 2005, you can use either SQL Express 2005 or 2008 for your purposes).
You can create a new database and do everything you need to from within the VS IDE but you'll probably find the SQL Management Studio environment much more intuitive and simpler to use as a beginner.
A quick note on SQL Express - Microsoft doesn't suggest it for 'production' environments due to limitations placed on the amount of RAM that Express can see/use and a few other factors. This is one of the few cases in which I agree - if you're doing anything complex that involves large databases or dozens of users then invest in MSSQL Workgroup Edition at least, or for Enterprise projects use MSSQL Standard or Enterprise versions.

Resources