Help: SqlConnection in ReadOnly Mode

  • Thread starter Thread starter Guramrit Singh
  • Start date Start date
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
 
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! |
*******************************************
 
Back
Top