3

Can't access Northwind database from Visual Studio

I am working on my own computer, and created tne Northwind database from a script file. i should be the admin on the computer and can access the table from SQL Server

From windows explorer, I right click the table and I can see two accounts that have full control (full control, modify, read etc are all checked). those accounts are SQLServerMSSQLUser$Gary-PC$Gary (Gary-PC\SQLServer.. Administrators (Gary-PC\Administrators).

However, when i select the table to try to connect to it in VS, i get the message, you do not have permissions to view this file.

is there something else I have to do in SQL server to set permissions? or might it have something to do with the user context not being one of these two users in visual studio?

gnackenson
  • 707
  • 3
  • 9
  • 23

1 Answers1

0

I guess you mean the Server Explorer/Database Explorer in Visual Studio, When you add a connection in Server Explorer there is a field for user name and password, however the default is using Windows Authentication, if you don't use that you probably have to set your user id correctly there.

Server Explorer/Database Explorer can be access from the View menu, for the existing connection you need choose the modify menu.

Please note if you connect from your code, the connection string is set in your code .NET, C# or configuration not from the server explorer, you need to set them separatly.


I don't have the exact the same version of C# Express installed, the settings might vary a little on different versions.

The connection string in Database Explorer/Server Explorer is depending on the the data source you use. You might want to look at this to connect to SQL Server using Microsoft SQL Server(SqlClient)

Then you can see the SQL Server Authentication method from Visual Studio Express.

You may also need to change the SQL Server Authentication, That is in SQL Server Management Studio Object Explorer, right-click the server, and then click Properties. On the Security page, You can see Server authentication, MSDN has that well documented.

Community
  • 1
  • 1
jcb00s
  • 91
  • 4
  • 1. I am using visual c# 2010 express .. I don't see server explorer on the view menu – gnackenson Jun 15 '13 at 18:26
  • 2. in .NET when you are creating a connection, where you can you modify the connection string? when you create a new data source, the connection string is greyed out. it is also greyed out in advanced properties while creating the connection. – gnackenson Jun 15 '13 at 18:30
  • I am using windows authentication. – gnackenson Jun 15 '13 at 18:31
  • i see database explorer, but the interface is the same. there is no way to modify username and password. – gnackenson Jun 15 '13 at 18:43
  • why is it so hard to connect to a database that you have created on your own pc??? – gnackenson Jun 15 '13 at 18:44