Permission to access dB problem in SQL Server 2005 Express from inside VS2005

R

raylopez99

I am trying to program a database from inside C++.NET via Visual
Studio 2005 using the ADO.NET set of classes, but this I believe is a
SQL Server 2005 Express permissions question under Windows XP
Professional OS.

In another thread, http://tinyurl.com/373lzx, I was able to open a
database successfully using VS2005 (thanks to a suggestion by Erland
Sommarskog). But subsequent to this I played around with the local
policy permissons while logged in as Administrator and may have
blocked access to this database. How to undo this? (I forgot what I
changed, but at the time it was pretty innocuous, and none of my other
programs have been affected).

Two problems really:

0/ though I can create and access a new database as a Power User, I
cannot access the old database anymore. Literally I have a red 'x'
next to the icon for the old database, and I get the error, under the
Server Explorer of Visual Studio 2005, when I right click "refresh" of
"Exception of the type 'System.Exception' was thrown".

1/ Switching to Administrator is no help (see below for the error),
but that also raises another question (see Q2 below)

2/ I played around with SQL Server 2005 Express Manager,and tried
adding various groups, but to no avail.

Question #1: how to undo this

Question #2: how to add "Admin" as an "object" or whatever you call
it under the SQL Server 2005 Express manager so I avoid the below
error (i.e., so Admin can access this dB).

Thank you.

RL

-
No connection the following error occurred: Unable to open the
physical file "C
\Program Files\Microsoft SQL Server\MSSQL.1\MSSQL\DATA
\NEWPC_USERDCV_DB.mdf". Operating system error 32: "32(The process
cannot access the file because it is being
used by another process.)".
Unable to open the physical file "C:\Program Files\Microsoft SQL Server
\MSSQL.1
MSSQL\DATA\NEWPC_USERDCV_DB_log.LDF". Operating system error 32:
"32(The process canot access the file because it is being used by
another process.)".
Cannot open database "NEWPC_USERDCV_DB" requested by the login. The
login failed.
Login failed for user 'PC_NAME-PC_USER\Administrator'.
File activation failure. The physical file name "C:\Program Files
\Microsoft SQL
Server\MSSQL.1\MSSQL\DATA\NEWPC_USERDCV_DB_log.LDF" may be incorrect.
Press any key to continue . . .
 
R

raylopez99



Thanks but I was thinking of a less extreme fix.

I'm thinking there must be some way of 'unlocking' the old database.
The reason is, I figured out a workaround, in that I constructed the
same database from scratch, from inside of VS 2005 (i.e. mechanically
reconstructing the entire database), and the new, identical database
can now be accessed as before, from inside VS 2005, and the connection
works (refresh works, 'test connection' from Modify also works, and
the program accessing the new database). But the old database still
has a red "X" next to it, and refreshing does not work.

Just a weird aspect.

I've ordered some books on dB programming and maybe they'll have some
insight, but in general I'd like to know how to reset permissions and/
or fix such problems in the future (short of reconstructing the
database 'from scratch' as I did here)

RL
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top