我正在安装 SQL Server Express 2005 作为我的 c# windows 窗体应用程序的先决条件,并且在我的安装程序类的自定义操作下,我正在尝试执行下面的脚本,以在用户计算机上创建我的数据库。
但是,当我选择在 C:\ 驱动器(Windows 根文件夹)上创建数据库时,我收到此错误/异常:
Operating system error 5(access is denied)
如果我尝试在任何其他驱动器中这样做,我不会收到任何错误。
请帮我。如何获得此 SQL 查询的相关权限?
USE [master]
GO
/****** Object: Database [Society_security_database] Script Date: 08/11/2012 14:26:23 ******/
CREATE DATABASE [Society_security_database] ON PRIMARY
( NAME = N'Society_security_database', FILENAME = N'C:\Society_security_database.mdf' , SIZE = 2048KB , MAXSIZE = UNLIMITED, FILEGROWTH = 1024KB )
LOG ON
( NAME = N'Society_security_database_log', FILENAME = N'C:\Society_security_database.ldf' , SIZE = 1024KB , MAXSIZE = 2048GB , FILEGROWTH = 10%)
COLLATE SQL_Latin1_General_CP1_CI_AS
GO
EXEC dbo.sp_dbcmptlevel @dbname=N'Society_security_database', @new_cmptlevel=90
GO
IF (1 = FULLTEXTSERVICEPROPERTY('IsFullTextInstalled'))
begin
EXEC [Society_security_database].[dbo].[sp_fulltext_database] @action = 'enable'
end
GO
ALTER DATABASE [Society_security_database] SET ANSI_NULL_DEFAULT OFF
GO
ALTER DATABASE [Society_security_database] SET ANSI_NULLS OFF
GO
ALTER DATABASE [Society_security_database] SET ANSI_PADDING OFF
GO
ALTER DATABASE [Society_security_database] SET ANSI_WARNINGS OFF
GO
ALTER DATABASE [Society_security_database] SET ARITHABORT OFF
GO
ALTER DATABASE [Society_security_database] SET AUTO_CLOSE OFF
GO
ALTER DATABASE [Society_security_database] SET AUTO_CREATE_STATISTICS ON
GO
ALTER DATABASE [Society_security_database] SET AUTO_SHRINK OFF
GO
ALTER DATABASE [Society_security_database] SET AUTO_UPDATE_STATISTICS ON
GO
ALTER DATABASE [Society_security_database] SET CURSOR_CLOSE_ON_COMMIT OFF
GO
ALTER DATABASE [Society_security_database] SET CURSOR_DEFAULT GLOBAL
GO
ALTER DATABASE [Society_security_database] SET CONCAT_NULL_YIELDS_NULL OFF
GO
ALTER DATABASE [Society_security_database] SET NUMERIC_ROUNDABORT OFF
GO
ALTER DATABASE [Society_security_database] SET QUOTED_IDENTIFIER OFF
GO
ALTER DATABASE [Society_security_database] SET RECURSIVE_TRIGGERS OFF
GO
ALTER DATABASE [Society_security_database] SET ENABLE_BROKER
GO
ALTER DATABASE [Society_security_database] SET AUTO_UPDATE_STATISTICS_ASYNC OFF
GO
ALTER DATABASE [Society_security_database] SET DATE_CORRELATION_OPTIMIZATION OFF
GO
ALTER DATABASE [Society_security_database] SET TRUSTWORTHY OFF
GO
ALTER DATABASE [Society_security_database] SET ALLOW_SNAPSHOT_ISOLATION OFF
GO
ALTER DATABASE [Society_security_database] SET PARAMETERIZATION SIMPLE
GO
ALTER DATABASE [Society_security_database] SET READ_WRITE
GO
ALTER DATABASE [Society_security_database] SET RECOVERY SIMPLE
GO
ALTER DATABASE [Society_security_database] SET MULTI_USER
GO
ALTER DATABASE [Society_security_database] SET PAGE_VERIFY CHECKSUM
GO
ALTER DATABASE [Society_security_database] SET DB_CHAINING OFF