Connect to SQL Express database difficulties


Alan Gillott

I have just joined the "I'm sure I've missed something obvious club"

I have VBExpress 2008 installed with SQL Express 2008 with the SQL Express
management studio.

I started building a prototype database in Management Studio: nothing
complex, just a cascade of administratve tables to create a logical context
for the real data.
Next I created a project which would provide simple linked controls to
populate the tables to see if the concept worked.
Next I tried to Connect the Project to the Database.
I thought this would be easy as I had already experimented with an Access
database containing some typical data. however, after several days I am
still trying.
The process involves navigating through the wizard selecting Microsoft SQL
Server Database File and then navigating through Computer - Program Files -
Microsoft SQL Server - - Data and then <Mydatabase>.mdf

With VBE2005 +SQLE2005 it works beautifully (on Vista)
With VBE1008 +SQLE2008 it fails saying i am not authorised to open the
file!!!! (Win7 64bit)
I have to go via Program Files (x86) - Microsoft SQL Server -
MSSQL10.SQLExpress -MSSQL - Data - <my database>.mdf.
This gives me; "you don't have permission to open this file" "Contact the
file Owner or Administrator to obtain permission". Well, that's me! I can't
see anything in the permissions that makes this file inaccessible to a user
who is also the administrator?
So what stupid thing have I done wrong?

As an aside, this seems to me to be an almighty cackhanded way of doing this
when SQL server has all these lovely tables the wizard could use to go
straight there: or am I being punished for being a poor member of the
underclass who uses Express?

Thank you


First off - It has nothing to do with SQL Express. (free version vs paying
The real version would/could give you the same issue.

When you run VS2008 ( before you click on it ) - right click on it and
select "run as administrator".

See if that works first. up the SQL2008 server in management studio - and you might
have to add yourself as a valid user for the file.

I remember those were my issues originally when I started playing with it.


Alan Gillott

Thank you Miro'
Run as administrator did the trick: looks as if VB2005 installed this way,
2008 didn't. c'est la vie!

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