.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
david stephan
Gaurav Pal
Post New Web Links

Database permissions required for Smo.Server.NetName

Posted By:      Posted Date: April 10, 2011    Points: 0   Category :

Hi all,

who can explain why when i use this code:

  ServerConnection conn = ServerConnection(serverName);

  var server = new Server(conn);
  string testInstance = server.NetName

next exception is thrown:

"Caught exception in SQL Product Configuration wizard. Exception: Microsoft.SqlServer.Management.Common.ExecutionFailureException: An exception occurred while executing a Transact-SQL statement or batch. ---> System.Data.SqlClient.SqlException: xp_regread() returned error 5, 'Access is denied.'
xp_regread() returned error 5, 'Access is denied.'
xp_regread() returned error 5, 'Access is denied.'"

user can connect using SQL management studio.

It will only work if i give user "SysAdmin" permission. Obviously it is too high of a permission to read server and db properties

Any help is much appreciated,


View Complete Post

More Related Resource Links

Required Permissions for SQL Server 2005 DB and Impersonation

I have an Intranet ASP.NET WebForm application that uses Integrated Windows authenication and Impersonation (required becuase triggers are used to create audit logs) to connect to a SQL Server 2005 DB on the same box (no double hop issues). Normal users get their DB permissions via the <Domain\Domain Users AD group, which has a SQL Server login and a user created for the DB.  Everything works fine when I explictly grant the associated DB user CONTROL permissions on the DB.

However, after doing more research on the actual permissions granted via CONTROL, this seems to be way too much access.  The best decription of the CONTROL permission I found was at http://www.mssqltips.com/tip.asp?tip=1718, which states, "This grants the equivalent to ownership over the database. The db_owner fixed database role has this permission implicitly."  However, every other DB permission combination I've tried without granting CONTROL always fails to connect to the DB.  Impersonation is working, the correct accessing Domain/User is referenced in the error message.  The approriate User in the DB is in the db_datareader and db_datawriter roles and when I explictly grant them every single permission on the DB except CONTROl they fail with a "

what permissions required fro Lnked Server


Hi All,

Need some help regarding Linked Server.

Environment:SQL Server 2005 , sp2



Goal: I want to check the properties of my Linked server.




I have db machine and two instance are running SQL01 and SQL02.

From SQL01, i have a created a Linked server to SQL02 using sysadmin accnt

 /* script */

/****** Object: LinkedServer [machine\SQL02] ******/

EXEC master.dbo.sp_addlinkedserver

@server = N'machine\SQL02',

@srvproduct=N'SQL Server'

/* For security reasons the linked server remote logins password is changed with */

EXEC master.dbo.sp_addlinkedsrvlogin







EXEC master.dbo.sp_serveroption


@optname=N'collation compatible',



EXEC master.dbo.sp_serveroption


@optname=N'data access',



EXEC master.dbo.sp_serveroption





EXEC master.dbo.sp_serveroption



MS SQL Server: Disconnect Users From Database - Kill User Session

If you ever wanted to restore your database from a SQL backup file (.bak), but there are still users connected to your database, the backup operation will fail causing the error: Exclusive access could not be obtained because the database is in use.

Publishing SQL Server Database using Publishing Wizard : Tips & Tricks

We can use SQL Server Publishing Wizard to deploy our local Database to remote hosting server/production server.This feature is available in SQL Server 2008/VWD 2008.

Below is the complete step by step guide of this process.

Connestion string create any database server

This links important to how to create connection string to any data base sever.

SQL Server Database Transaction

A transaction is a group of SQL commands executed together as a single component of work to be accomplished. If all of these commands succeed, then a transaction is committed - the changes to the data are made final. If any of the commands within a transaction fail, then the entire transaction is cancelled, or in SQL Server terms, the transaction will be rolled back.

Transactions are one of the things that keep your data safe, but they're not necessarily easy to understand. Here's some help:

Database Export Wizard for ASP.net and SQL Server

A step wizard for ASP.net to export database objects to CSV, TXT, HTML, XML, or SQL. it guides users through a few simple steps to choose a database object (table, view, or query), select columns, and export the data in any of the standard formats CSV, HTML, XML, or SQL.

Connecting to MS SQL Server database using webmatrix.



I am novice  user to raizor syntax using webmatrix and i am trying to connect MS Sql server database (instead of using .sdf file i am using .mdf file) using the tool webmatrix for startersite.

The connection string that i setup as follows.

<?xml version="1.0"?>


        <compilation debug="false" targetFramework="4.0" />
    <add name="OESConnectionString" connectionString="Data Source=.\SQLServer2005;AttachDbFilename=|DataDirectory|\OES_Data.mdf;Integrated Security=True;User Instance=True" providerName="System.Data.SqlClient" />


And i am using websecurity helper as well and the setup is as follows.

WebSecurity.InitializeDatabaseConnection("Data Source=INLTE5556\\SQLServer2005;Initial Catalog=OES;Integrated Security=True", "System.Data.SqlClient", "UserProfile", "UserId", "Email", true);

When i am trying to insert the user details into database i am getting the below error.

Format of t

sql server 2008 adventureworks database


dear Friends

For my MCTS 70 -433 examination, I recently installed sql server 2008 and installed the sample databases too. but my issue is, in that book they have mentioned a database called "AdventureWorks2008" and the nice thing is I don't have a such a database with me in my sql server 2008. 

And the query is 

-- MERGE Statement
USE AdventureWorks2008
MERGE INTO	Sales.SalesOrderDetailHistory AS SODH
USING Sales.SalesOrderDetail AS SOD
ON SODH.SalesOrderID = SOD.SalesOrderID
AND SODH.SalesOrderDetailID = SOD.SalesOrderDetailID
INSERT (LineTotal, SalesOrderID, SalesOrderDetailID, CarrierTrackingNumber, OrderQty
, ProductID, SpecialOfferID, UnitPrice, UnitPriceDiscount
, rowguid, ModifiedDate, Cancelled)
VALUES(LineTotal, SalesOrderID, SalesOrderDetailID, CarrierTrackingNumber, OrderQty
, ProductID, SpecialOfferID, UnitPrice, UnitPriceDiscount
, rowguid, ModifiedDate, DEFAULT)
UPDATE SET SOHD.Cancelled = 'True'
OUTPUT $action , inserted.* ;	

Please help me to overcome this issue and let me know where can I download that database too.

Thanking you

happy Coding

How to extract a schema from a sql server database



  I need to extract or get the schema from tables in my databse and what is the best way to do it. Is there any third party tool to do it??


Any idea will be appreciated..



sql server 2005 enterprise edition is required


sql serve 2005 enterprise edition is required to work with microsoft enterprise blocks


Required permissions cannot be acquired when host asp.net 3.5 application in godaddy


I got the following error when click print report button.

Application : asp.net 3.5

Crystal report : 10.5

Host: godaddy

Please help me.


Required permissions cannot be acquired.

Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. 

Exception Details: System.Security.Policy.PolicyException: Required permissions cannot be acquired.

Source Error: 

An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.

Metadata: Create a Database Schema Repository with Meta Data Services in SQL Server 2000


SQL Server 2000 Meta Data Services is a repository technology that stores and manages metadata for SQL Server. Instead of building database schemas over and over, Meta Data Services allows you to freeze an entire schema for use in other projects. You can also use these schemas for training, testing, or debugging. In this article, the authors will review the various components of Meta Data Services and show how it can be programmed using a Visual Basic client, XML, and XSLT. They will also show you how to manage and manipulate your metadata by generating a simple database schema using a SQL Server repository.

Alok Mehta and Ricardo Rodriguez

MSDN Magazine May 2003

Info on the Go: Wireless Internet Database Connectivity with ASP, XML, and SQL Server


Many handheld wireless devices such as cellular phones and PDAs already have the ability to access Web sites. So how do you build Web applications that tap this wireless audience? Although there are a number of limitations to wireless devices-such as screen size, navigation, and connection speed-you can use familiar Web development technologies to make your existing Web applications available to mobile users. This article outlines the services and equipment currently available to support wireless Web access. A sample wireless-accessible Web site that dynamically draws data from a SQL Server database back end in real time is created using tools such as ASP and XML.

Srdjan Vujosevic and Robert Laberge

MSDN Magazine June 2000

Upsize Your Database: Convert Your Microsoft Access Application to Take Advantage of SQL Server 7.0


What if you need to convert an existing Microsoft Access 97 database application into a true client-server application that is based on a SQL Server back end? If you know a little about Visual Basic and SQL Server, it's easy to make your app take advantage of the power and scalability provided by SQL Server 7.0. Using some concrete code examples, this article takes you step by step through converting the native Jet queries in your Access application into stored procedures and pass-through queries that SQL Server can use. You'll also learn how to pass on parameters when your client-server app calls these SQL Server stored procedures and queries.

Michael McManus

MSDN Magazine June 2000

cannot attach database from server explorer


Hello all,

In Server Management Studio, I am attempting to attach a database.  After selecting the database in the wizard

I receive an error: This file is in use, Enter a new name or close the file that's open in another program. 

I don't have SSMS open, and have restarted the computer to make sure the memory is cleared.  Not sure what to try next.  Any ideas?

How to get access to content database after server hardware failure


Sharepoint server 2007 and remote sql 2000 SP4 database, after ShraPoint server crash only content databases are available and intact. Trying to restore from backup fail, stsadm -o restore says that not valid backup is available on path. How to get access to available content database using a new installation with same server name, ip address and partitions configuration. How to recover site with content databases information.

Regards, thanks for help.

Victor Naranjo MCSE + Security MCSA + Security MCSE + Messaging MCSA + Messaging ITIL Certified Comptia Security+
ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend