56eb03284d50fff55dc422fab00d0e217a94b331
API/CodeSamples/SqlServerConnectionString.md
| ... | ... | @@ -0,0 +1,46 @@ |
| 1 | +#SqlServerConnectionString |
|
| 2 | + |
|
| 3 | +The SqlServerconnectionString is what Izenda AdHoc uses to initialize an MSSQL connection. This will do all the heavy lifting for including tables, functions, and stored procedures. It will also build queries utilizing the Izenda MSSQLDriver. |
|
| 4 | + |
|
| 5 | +##Global.asax (C♯) |
|
| 6 | +```c# |
|
| 7 | + |
|
| 8 | +//main class: inherits DatabaseAdHocConfig or FileSystemAdHocConfig |
|
| 9 | +public class CustomAdHocConfig : Izenda.AdHoc.DatabaseAdHocConfig |
|
| 10 | +{ |
|
| 11 | + // Configure settings |
|
| 12 | + // Add custom settings after setting the license key and connection string by overriding the ConfigureSettings() method |
|
| 13 | + public static void InitializeReporting() { |
|
| 14 | + //Check to see if we've already initialized. |
|
| 15 | + if (HttpContext.Current.Session == null || HttpContext.Current.Session["ReportingInitialized"] != null) |
|
| 16 | + return; |
|
| 17 | + AdHocSettings.LicenseKey = "INSERT_LICENSE_KEY_HERE"; |
|
| 18 | + //Creates a connection to Microsoft SQL Server |
|
| 19 | + AdHocSettings.SqlServerConnectionString = "INSERT_CONNECTION_STRING_HERE"; |
|
| 20 | + Izenda.AdHoc.AdHocSettings.AdHocConfig = new CustomAdHocConfig(); |
|
| 21 | + HttpContext.Current.Session["ReportingInitialized"] = true; |
|
| 22 | + } |
|
| 23 | +} |
|
| 24 | +``` |
|
| 25 | + |
|
| 26 | +##Global.asax (VB.NET) |
|
| 27 | + |
|
| 28 | +```visualbasic |
|
| 29 | + |
|
| 30 | +'main class: inherits DatabaseAdHocConfig or FileSystemAdHocConfig |
|
| 31 | +Public Class CustomAdHocConfig |
|
| 32 | + Inherits Izenda.AdHoc.DatabaseAdHocConfig |
|
| 33 | + |
|
| 34 | + Shared Sub InitializeReporting() |
|
| 35 | + 'Check to see if we've already initialized |
|
| 36 | + If HttpContext.Current.Session Is Nothing OrElse HttpContext.Current.Session("ReportingInitialized") IsNot Nothing Then |
|
| 37 | + Return |
|
| 38 | + 'Initialize System |
|
| 39 | + AdHocSettings.LicenseKey = "INSERT_LICENSE_KEY_HERE" |
|
| 40 | + AdHocSettings.SqlServerConnectionString = "INSERT_CONNECTION_STRING_HERE" |
|
| 41 | + Izenda.AdHoc.AdHocSettings.AdHocConfig = New CustomAdHocConfig() |
|
| 42 | + HttpContext.Current.Session("ReortingInitialized") = True |
|
| 43 | + End Sub |
|
| 44 | + |
|
| 45 | +End Class |
|
| 46 | +``` |
|
| ... | ... | \ No newline at end of file |