Friday, February 24, 2012

dbcc checkprimaryfile

Hello All,

I am going crazy tring to find out why I keep getting this error when I execute a simple

dbcc checkprimaryfile (N'C:\backup\databasename.mdf', 0) from ADO.Net. This works just fine from Query analyzer.

By the way, I am running SQL Server 2005 and .Net 2.0.

Here the complete error:

CREATE FILE encountered operating system error5 (Access is denied) while attempting to open or create the physical file 'C:\backup\databasename.mdf.

Note that the database file is not in use as I have detached it.

Any help would be greatly appreciated!

Thanks!

Amine

Are you using the same connection string ? So arr you connecting to the same server with the same credentials ? Seems that the user in ADO.NET does not have the appropiate permissions.

HTH, Jens K. Suessmeyer.

http://www.sqlserver2005.de

|||

yes, I am using the same connection and I am logging in with sa account in the ADO.Net connection string.

|||

All,

I figured out what the problem was: the Initial catalog was not set in the connection string!

Thanks.

No comments:

Post a Comment