Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8499759
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T00:45:19+00:00 2026-06-11T00:45:19+00:00

I am installing SQL Server Express 2005 as a prerequisite of my c# windows

  • 0

I am installing SQL Server Express 2005 as a prerequisite of my c# windows form application, and under the Custom Action of my installer class, I’m trying to execute the script below, to create my database on the user machine.

However when I choose to create the database on the C:\ drive(the windows root folder), I am getting this error/exception:

Operating system error 5(access is denied)

I do not get any error if I try to do so in any other drive.

Please Help me. How can I get the relevant privileges for this SQL query?

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 
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-11T00:45:20+00:00Added an answer on June 11, 2026 at 12:45 am

    Finally reached to the solution
    Because i was trying to access from a database as from Network Service account . when i changed that to local system it worked ! Here is the code

    Microsoft.SqlServer.Management.Smo.Wmi.ManagedComputer mc = new Microsoft.SqlServer.Management.Smo.Wmi.ManagedComputer();
                    Microsoft.SqlServer.Management.Smo.Wmi.Service svc = mc.Services["MSSQL$SQLEXPRESS"];
                    svc.SetServiceAccount("LocalSystem",null);
                    svc.Alter();
                    SqlConnection.ClearAllPools();
    

    It changes the service account to localSystem

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm having problems installing SQL Server as prerequisite on my Visual Studio Setup application
I'm creating an install package using InnoSetup and installing SQL Server 2005 Express. Here's
I'm installing SQL Server 2008 Express along with my application, via a bootstrapper. I
While installing SQL Server 2005, I unknowingly uninstalled the existing SQL Express(I dont know
I'm installing SQL Server Express 2005 from my Visual Studio 2008 setup project. This
I installed SQL Server 2005 Express edition on my system. I am using Windows
I have developed a .NET desktop application which uses SQL Server 2005 SP3 Express.
I installed SQL Server Express 2005 a few years ago. Since then I've installed
When installing SQL Server Express Edition 2008, checklist says Previous version of Visual Studio
I'm getting crazy trying to install SQL Server Express Management Studio 2008 Pb for

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.