API/CodeSamples/UseNoLock.md
... ...
@@ -0,0 +1,53 @@
1
+#UseNoLock
2
+
3
+[[_TOC_]]
4
+
5
+#About
6
+
7
+Gets or sets the value indicating whether the NOLOCK statment will be used in SQL queries. Prior to version 6.6, this setting defaults to false. Any version after that will automatically use NOLOCK in queries.
8
+
9
+Below is a sample global.asax using the UseNoLock setting. The code block will appear within ``<script runat="server"> </script>`` tags within global.asax.
10
+
11
+##Global.asax (C♯)
12
+
13
+```csharp
14
+//main class: inherits DatabaseAdHocConfig or FileSystemAdHocConfig
15
+public class CustomAdHocConfig : Izenda.AdHoc.DatabaseAdHocConfig
16
+{
17
+ // Configure settings
18
+ // Add custom settings after setting the license key and connection string by overriding the ConfigureSettings() method
19
+ public static void InitializeReporting() {
20
+ //Check to see if we've already initialized.
21
+ if (AdHocContext.Initialized)
22
+ return;
23
+ AdHocSettings.LicenseKey = "INSERT_LICENSE_KEY_HERE";
24
+ //Creates a connection to Microsoft SQL Server
25
+ AdHocSettings.SqlServerConnectionString = "INSERT_CONNECTION_STRING_HERE";
26
+ AdHocSettings.UseNoLock = false; //the relevant setting
27
+ Izenda.AdHoc.AdHocSettings.AdHocConfig = new CustomAdHocConfig();
28
+ AdHocContext.Initialized = true;
29
+ }
30
+}
31
+```
32
+
33
+##Global.asax (VB.NET)
34
+
35
+```visualbasic
36
+
37
+'main class: inherits DatabaseAdHocConfig or FileSystemAdHocConfig
38
+Public Class CustomAdHocConfig
39
+ Inherits Izenda.AdHoc.DatabaseAdHocConfig
40
+
41
+ Shared Sub InitializeReporting()
42
+ 'Check to see if we've already initialized
43
+ If AdHocContext.Initialized Then
44
+ Return
45
+ 'Initialize System
46
+ AdHocSettings.LicenseKey = "INSERT_LICENSE_KEY_HERE"
47
+ AdHocSettings.SqlServerConnectionString = "INSERT_CONNECTION_STRING_HERE"
48
+ AdHocSettings.UseNoLock = False 'the relevant setting
49
+ Izenda.AdHoc.AdHocSettings.AdHocConfig = New CustomAdHocConfig()
50
+ AdHocContext.Initialized = True
51
+ End Sub
52
+End Class
53
+```
... ...
\ No newline at end of file