• austen.robinson (4/24/2013)


    So let me understand. Where do I install my SQL Server during the installation? Or is it a problem with the VS project? Confused.

    Ok your problem is purely permissions to a specific folder.

    The SQL Service typically runs as a user who is not a local admin on the operating system, so cannot read data from any users Desktop/documents:

    your fix is simple: if you are going to attach a database via conneciton string, the file cannot be in your personal folders.

    Create a c:\SQLData folder, for exmaple, and put it there, or put it in the folder i mentioned above, since that is where SLq has at least four other databases already.

    then change your connection string to match the new folder:

    <connectionStrings>

    <add name="DefaultConnection" providerName="System.Data.SqlClient" connectionString="AUSTENSSAMSUNG\SQLEXPRESS;Initial Catalog=aspnet-learning1-20130420131735;Integrated Security=SSPI;AttachDBFilename=C:\SQLData\aspnet-learning1-20130420131735.mdf" />

    <add name="test"

    connectionString="Data Source=AUSTENSSAMSUNG\SQLEXPRESS;AttachDbFilename=|DataDirectory|\wingtiptoys.mdf;Integrated Security=True"

    providerName="System.Data.SqlClient " />

    </connectionStrings>

    the second option is to go to the service, and make it start as yourself...since you are a local admin on your own laptop/machine, the permissions problem would also go away:

    you can prove this is the issue by simply putting in your credentials, with your domain account and password, and confirm the external object you were trying to access/use works when SQL is run your credentials, so you'd know you need a domain or local account to access the resource.

    note you have to stop and start the service after you change the credentials before it will start using those credentials.

    Lowell


    --help us help you! If you post a question, make sure you include a CREATE TABLE... statement and INSERT INTO... statement into that table to give the volunteers here representative data. with your description of the problem, we can provide a tested, verifiable solution to your question! asking the question the right way gets you a tested answer the fastest way possible!