Help: SqlConnection in ReadOnly Mode

G

Guramrit Singh

Hello Everybody,
I want to connect to sql server in readonly mode so that any DML/DDL query
cannot be executed. It's possible in Access Database using OleDb by
specifying in connection string, But I'm unable to find it in sql server.

Thanx in advance
 
G

Gregory A. Beamer

I want to connect to sql server in readonly mode so that any DML/DDL
query cannot be executed. It's possible in Access Database using OleDb
by specifying in connection string, But I'm unable to find it in sql
server.

This is due to the difference between a file based database and a server
based database.

ANSWER: Use a connection string with an account that only has readonly
rights.

If you set up an account in SQL Server that does not have a role (or
permission) that allows the execution of anything other than SELECT,
then that account will not be able to do anything other than SELECT.

Easiest: Put account in datareader role

You can also set up so the user has full DML rights, but no DDL rights.

Easiest: Put account in datareader and datawriter roles

Peace and Grace,

--
Gregory A. Beamer (MVP)

Twitter: @gbworld
Blog: http://gregorybeamer.spaces.live.com

*******************************************
| Think outside the box! |
*******************************************
 

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

Top