Re: MDF file vs. Local Sql Server...what's the connection?




"Norman Yuan" <NoAddress@xxxxxxxxxxxx> wrote in message
news:en6Oh%23iHIHA.5980@xxxxxxxxxxxxxxxxxxxxxxx

When you use ASP.NET management wizard, it create a database on available
SQL Server or SQL Server Express. The *.mdf file is just database's file
in app_data folder. You do not deal with the file itself, SQL
Server/Express does. Once the database is created, you cannot touch the
*.mdf file at all: you canot copy/move/delete it.

this all gets more confusing than it ought to, but: if your MDF file is
detached from the database, you can move it anyplace you want to and then
re-attach it to any edition of SQL Server. Alternatively, you can do a
backup and the restore that to any SQL instance in any version.

The placement of the MDF file in the App_Data folder was arbitrary; it
could be anywhere. You also do not have to have an AttachDBFile clause in
your connection string; your MDF file(s) can just be permanently attached
on the DB, which is the usual practice on production databases.

All of these wizards and the VS IDE itself are all very nice (sort of) but
I'm afraid that more often than not they severely impair an understanding of
how things are working. People all over the place are dropping data sets,
fooling with the designers and not having a clue that behind the scenes the
only thing happening of any consequence is that Visual Studio is writing a
data access class for you. This is not a good thing. Ultimately you will
be WAY ahead of the game if you learn how to write SQL DDL to create
databases, tables, views, etc ... and how to write your own data access
classes. At that point, if you want to use the tools to reduce the tedious
work at least you will have some understanding of what they are doing. Of
course that's a fair amount of work and you should probably only do it if
you're at least half serious about writing code for a living or otherwise.
On the other hand, learning to use Visual Studio's wizards, designers, etc.
is ALSO a lot of work .... and might drive you crazy when things go wrong
(they will) and you have no idea how to fix them.

The tools CAN be useful, to be sure ... but remember one thing: there is
nothing you have ever seen in any .NET application that could not have been
written 100% in Notepad. I would not suggest doing this, but understanding
that it's true and *why* it's true will take you a long way towards a solid
understanding of the technology.

Norman is right: learn the basics of SQL Server architecture and management
and all of this stuff shoud begin to fall into place.



.



Relevant Pages

  • Re: MSDE users guide
    ... You are "right on" with your understanding of my problem. ... I am going to download the ... MSDE is missing a key component of SQL Server, ... basic tool for database creation and probing existing databases. ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: ASPNETDB.MDF when no SQLExpress, only SQL Server 2005?
    ... You will need to upload the mdf file and have your webhost attach it to the sql server. ... In which case you will need to recreate the database into the database which is available to the hosted domain if you have signed up ... The connection will be closed. ...
    (microsoft.public.dotnet.framework.aspnet)
  • Re: Lost Log File !
    ... Create a new database with same MDF and LDF name ... stop sql server and delete the new MDF file and copy the old MDF file ... Start SQL Server and see the status. ... > Create a new database with same MDF and LDF name ...
    (microsoft.public.sqlserver.clients)
  • RE: Logging into a restored db
    ... Start with reviewing these articles to get a better understanding why you are seeing the ... 224071 INF: Moving SQL Server Databases to a New Location with Detach/Attach http://support.microsoft.com/?id=224071 ... 274463 INF: Understanding and Troubleshooting the Copy Database Wizard in SQL http://support.microsoft.com/?id=274463 ...
    (microsoft.public.sqlserver.security)
  • Re: MOSS2007 and SQL2005 on Single Server
    ... My understanding is that it is *any* database. ... However naturally that is likely to be a content database ... ... The version for WSS 3.0 isn't because a single server setup is quite feasible for that. ... isn't such a problem as the free version of embedded SQL Server 2005 Express ...
    (microsoft.public.sharepoint.portalserver)