Open Read-Only SQL Connection?

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Is there a way to open a read-only SQL connection? I like to give the user
the ability to write queries but not the ability to update/delete data.

I guess I could create a new user account ... but is there a way to specify
the read/write state in a SQLConnection or SQLCommand?

Thanks!
 
I think this is more of a SQL question, but I'll take a stab.

I think you're best bet, though any attempt to let users define their own
queries entirely is risky, is to set up permissions on the database itself.
Basically, you would create a user that only has Select permissions to the
tables that are allowed to be queries.

Let me iterate again that allowing users to fully define queries is very
risky, regardless. I would try to limit is somehow to specific tables,
columns, etc. Maybe let them define parts of a WHERE clause and what
columns from a pre-defined list are returned. Think something along the
lines of Reporting Services.

Hope this helps,


Steve
 
I think this is more of a SQL question, but I'll take a stab.

I think you're best bet, though any attempt to let users define their own
queries entirely is risky, is to set up permissions on the database itself.
Basically, you would create a user that only has Select permissions to the
tables that are allowed to be queries.

Let me iterate again that allowing users to fully define queries is very
risky, regardless. I would try to limit is somehow to specific tables,
columns, etc. Maybe let them define parts of a WHERE clause and what
columns from a pre-defined list are returned. Think something along the
lines of Reporting Services.

Hope this helps,


Steve
 
Spam Catcher said:
Is there a way to open a read-only SQL connection? I like to give the user
the ability to write queries but not the ability to update/delete data.

I guess I could create a new user account ... but is there a way to
specify
the read/write state in a SQLConnection or SQLCommand?

No, setup a generic user account that has read only access to a database or
table.
 
Back
Top