سؤال

I was asked to repost this question, due to the answers were not going the right directions.

I have a detached database similar to to Northwind.MDF I want to import a .CVS file into this MDF file. I have the mdf file as part of my Solution Explorer in vs2010 and I can look work with the data, just no way to import. In vs2010 I can use the Server Explorer and connect with no problems. the connection string looks like this:

Data Source=.\SQLEXPRESS;AttachDbFilename=D:\ASPX\sdb1\customer.mdf;Integrated Security=True;User Instance=True

When I try to use any tool outside of vs2010 I cannot connect. Non of the sqlserver tools connect and give me an access denied, even when I try to attach the file from within Management Studio.

TITLE: Microsoft SQL Server Management Studio

Attach database failed for Server 'STEPHANS-PC\SQLEXPRESS'. (Microsoft.SqlServer.Smo)


ADDITIONAL INFORMATION:

An exception occurred while executing a Transact-SQL statement or batch. (Microsoft.SqlServer.ConnectionInfo)


Unable to open the physical file "D:\ASPX\sdb1\customer.mdf". Operating system error 5: "5(Access is denied.)". (Microsoft SQL Server, Error: 5120)

This should not be this tuff to import data from a CSV.

هل كانت مفيدة؟

المحلول

You have to connect to your user instance database using an special connection string. An user instance database is a sql express database based upon an mdf file (just what you have).

This link explains how to connect from SSMS to your User Instance Database:

How to: Connect to a User Instance

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top