Opening MDF files with ADO.NET 2.0

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

An article in SQL Server magazine mentioned in passing that we can open MDF
files directly with ADO.NET 2.0. Is this true? Are there any
examples/tutorials of this? Does this mean that ADO.NET 2.0 is kind of like a
scaled-down in-memory version of SQL Server?
 
Ah no.
When you use AttachDBFilename, you still must reference a valid SQL Server
instance. The .MDF is attached to the master DB and remains attached from
that point forward. You can also opt to use the "Local Instance=True"
option. This copies the master and other SS support databases to the user's
filespace and then copies the .MDF file there too. This feature (SQL Server
Express only) permits full access to the user database by that user and
permits it to be uninstalled with the application.

I discuss this in detail in my new book (due out this summer).

hth

--
____________________________________
William (Bill) Vaughn
Author, Mentor, Consultant
Microsoft MVP
INETA Speaker
www.betav.com/blog/billva
www.betav.com
Please reply only to the newsgroup so that others can benefit.
This posting is provided "AS IS" with no warranties, and confers no rights.
__________________________________
 
Got it. Without the benefit of a code sample, I'm going to take another wild
guess. ADO.NET 2.0 allows us to refer to MDF files directly as a kind of
shorthand instead of knowing the SQL Server instance name and catalog. This
makes life easier for SQL Server Express? Am I close here?
--
Bryan, Emperor of String.Empty
http://songhaysystem.com


William (Bill) Vaughn said:
Ah no.
When you use AttachDBFilename, you still must reference a valid SQL Server
instance. The .MDF is attached to the master DB and remains attached from
that point forward. You can also opt to use the "Local Instance=True"
option. This copies the master and other SS support databases to the user's
filespace and then copies the .MDF file there too. This feature (SQL Server
Express only) permits full access to the user database by that user and
permits it to be uninstalled with the application.

I discuss this in detail in my new book (due out this summer).

hth

--
____________________________________
William (Bill) Vaughn
Author, Mentor, Consultant
Microsoft MVP
INETA Speaker
www.betav.com/blog/billva
www.betav.com
Please reply only to the newsgroup so that others can benefit.
This posting is provided "AS IS" with no warranties, and confers no rights.
__________________________________
 
Not really. You still need to know the server name (machine name) and
instance to get the AttachDBFilename to work.

--
____________________________________
William (Bill) Vaughn
Author, Mentor, Consultant
Microsoft MVP
INETA Speaker
www.betav.com/blog/billva
www.betav.com
Please reply only to the newsgroup so that others can benefit.
This posting is provided "AS IS" with no warranties, and confers no rights.
__________________________________

rasx said:
Got it. Without the benefit of a code sample, I'm going to take another
wild
guess. ADO.NET 2.0 allows us to refer to MDF files directly as a kind of
shorthand instead of knowing the SQL Server instance name and catalog.
This
makes life easier for SQL Server Express? Am I close here?
 
Back
Top