Page 1 of 1

How to prevent executing

Posted: Mon 19 May 2008 20:36
by ccmcbride
I have a query for reports. I have functionality to allow the user to change the query and test the results.
the query is being opened, not executed.
My tech figured out that even though it's being opened, he can write queries to change the database, using the testing functionality.
I am setting the sql text only, so how can I prevent the execution of a query, when all I want is it to open only?

Posted: Tue 20 May 2008 12:36
by Antaeus
SDAC does not check whether provided query modifies data. It just raises an exception if the query returns no result set when calling the Open method.
To prevent data modifications you can setup permissions for Logins on SQL Server.

Posted: Tue 20 May 2008 14:18
by ccmcbride
But I can't setup the permissions to not modify data at hundreds of client sites, otherwise, they wouldn't be able to use the program....

Posted: Wed 21 May 2008 06:47
by Antaeus
One more possible solutions is to start transaction before executing a query and rollback it after that.

Posted: Wed 21 May 2008 14:22
by ccmcbride
That's an idea. I have been having issues using transactions inside the program (way to many connections are required), but the report query has it's own connection...