Reputation: 1764
How can I interact with a .mdf or.ldf file? When I say interact, I mean view/edit fields, records on the desktop.
Its inside a websites App_Data folder.
Upvotes: 1
Views: 1465
Reputation: 654
To "interact" with an mdf file, you need to attach the database to an MS SQL Server.
After located the mdf file you can use follwing stored procedures:
sp_attach_db
ex:
EXEC sp_attach_db
@dbname = N'MyDatabase',
@filename1 = N'D:\DataFiles\MyDatabase_Data.mdf',
@filename2 = N'E:\LogFiles\MyDatabase_Log.ldf';
Wehn DB is attached you can connect with your connection string and do classical operations on database.
You can detach your DB with sp_detach_db
ex:
EXEC sp_detach_db
@dbname = N'MyDatabase';
MSDN sample : http://msdn.microsoft.com/fr-fr/library/ms179877.aspx
Upvotes: 1
Reputation: 48024
These are SQL Server files. MDF is the data file and LDF is the log file.
Basically, I think your web site is using SQL Server for it's data storage, and the database is stored in that APP_DATA folder.
Usually SQL Server installations come with Management Studio or Enterprise Manager (called Client Tools) unless the administrator chose not to install it on that machine.
Look under START / Programs / Microsoft SQL Server 2000/2005/2008. Then look for Enterprise Manager or SQL Server Management Studio.
In the ServerName, just put a period or dot, and use Windows Authentication to connect. If that does not work, you will need a username and password to connect to the database. You should be able to find either in the configuration files of the web project, or the website code.
If the Tools are not installed, then you will need the installation CD / DVD to install the client tools.
Alternately, you can install Tools (only Tools, you don't need the database engine) from SQL Express Edition from http://www.microsoft.com/express/sql/default.aspx?wa=wsignin1.0 on a different machine and access the database from there.
Upvotes: 1
Reputation: 65516
Use linq2sql to access the mdf.
There's an example in an answer here
Upvotes: 0