sql server - How to set transaction isolation level using classic ASP? -
i have classic asp page , want set transaction isolation level read uncommitted. using this documentation have came following:
set conn = getconnection conn.isolationlevel = adxactreaduncommitted 'conn.begintrans 'conn.committrans set cmd = server.createobject("adodb.command") set cmd.activeconnection = conn cmd.commandtype = adcmdtext cmd.commandtext = "insert [dbo].[a] ([isolationlevel]) select case transaction_isolation_level when 0 'unspecified' when 1 'readuncommitted' when 2 'readcommitted' when 3 'repeatable' when 4 'serializable' when 5 'snapshot' end transaction_isolation_level sys.dm_exec_sessions session_id = @@spid" set rs = cmd.execute() response.write(conn.isolationlevel) the last response.write gives me correctly 256 (read uncommitted) when query table got readcommitted records.
could tell doing wrong?
and here body of getconnection function:
function getconnection() dim strconnectiondotnet : strconnectiondotnet = "data source=..." set getconnection = server.createobject("adodb.connection") getconnection.connectionstring="provider=sqloledb;" & strconnectiondotnet getconnection.open end function
as said in documentation:
note: isolationlevel settings not work until next time begintrans called.
it kind of strange, need following:
conn.begintrans ... sql statement executed here conn.committrans even thought t-sql statement select. also, after conn.committrans still using default isolation level (the 1 specified in context of database).
Comments
Post a Comment