I met strange security result on my Delphi 10 Seattle using SQL Server 2008.
I need read-only DB access, so made dedicated r/o user; ADO connection string in TADOConnection uses its credentials. Test query
select system_user
shows its username.
T-SQL code looks like:
select SValue
from Table
where SValue = '1';
update Table
set SValue = '1';
In SQL Server Management Studio this code shows error if I login with r/o user. When I use this code in Delphi with TADOQuery.ExecSQL
, it also shows exception with r/o access error. But when I use it as TADOQuery.Open
it works fine and successfully updates the database.
What it could be a cause of such behavior and how I could prevent further write access on Open?