9fffe1f2ebcb9abf51987dc6ab4c02c87ee9fa0b
FAQ/ListReports.md
| ... | ... | @@ -94,36 +94,36 @@ public override ReportInfo[] ListReports() { |
| 94 | 94 | }//end method |
| 95 | 95 | ``` |
| 96 | 96 | |
| 97 | +##Sample VB.NET Methods |
|
| 97 | 98 | |
| 98 | -``` |
|
| 99 | -public class CustomAdHocConfig : Izenda.AdHoc.DatabaseAdHocConfig |
|
| 100 | -{ |
|
| 101 | - |
|
| 102 | - protected override Izenda.AdHoc.ReportInfo[] ListReports() |
|
| 103 | - { |
|
| 104 | - ArrayList reportNames = new ArrayList(); |
|
| 105 | - string sql = String.Format("SELECT Name, CreatedDate, ModifiedDate FROM {0} ORDER BY Name WHERE UserID='{1}'", AdHocSettings.SavedReportsTable, AdHocSettings.CurrentUserName); |
|
| 106 | - |
|
| 107 | - System.Data.IDbCommand command = null; |
|
| 108 | - try |
|
| 109 | - { |
|
| 110 | - command = Izenda.AdHoc.AdHocContext.Driver.CreateCommand(sql); |
|
| 111 | - System.Data.IDataReader reader = command.ExecuteReader(); |
|
| 112 | - |
|
| 113 | - while (reader.Read()) |
|
| 114 | - { |
|
| 115 | - string reportName = reader["Name"].ToString(); |
|
| 116 | - DateTime createdDate = (DateTime)reader["CreatedDate"]; |
|
| 117 | - DateTime modifiedDate = (DateTime)reader["ModifiedDate"]; |
|
| 118 | - if (reportName != "") |
|
| 119 | - reportNames.Add(new Izenda.AdHoc.ReportInfo(reportName, false, createdDate, modifiedDate)); |
|
| 120 | - } |
|
| 121 | - } |
|
| 122 | - catch (Exception) { } |
|
| 99 | +###DatabaseAdHocConfig |
|
| 123 | 100 | |
| 124 | - if (command.Connection.State == System.Data.ConnectionState.Open) |
|
| 125 | - command.Connection.Close(); |
|
| 126 | - return (Izenda.AdHoc.ReportInfo[])reportNames.ToArray(typeof(Izenda.AdHoc.ReportInfo)); |
|
| 101 | +``` |
|
| 102 | +Public Class CustomAdHocConfig |
|
| 103 | + Inherits Izenda.AdHoc.DatabaseAdHocConfig |
|
| 104 | + |
|
| 105 | + Protected Overrides Function ListReports() As Izenda.AdHoc.ReportInfo() |
|
| 106 | + Dim reportNames As New ArrayList() |
|
| 107 | + Dim sql As String = String.Format("SELECT Name, CreatedDate, ModifiedDate FROM {0} ORDER BY Name WHERE UserID='{1}'", AdHocSettings.SavedReportsTable, AdHocSettings.CurrentUserName) |
|
| 108 | + |
|
| 109 | + Dim command As IDbCommand = Nothing |
|
| 110 | + Try |
|
| 111 | + command = Izenda.AdHoc.AdHocContext.Driver.CreateCommand(sql) |
|
| 112 | + Dim reader As IDataReader = command.ExecuteReader() |
|
| 113 | + |
|
| 114 | + While reader.Read() |
|
| 115 | + Dim reportName As String = reader("Name").ToString() |
|
| 116 | + Dim createdDate As DateTime = Convert.ToDateTime(reader("CreatedDate").ToString()) |
|
| 117 | + Dim modifiedDate As DateTime = Convert.ToDateTime(reader("ModifiedDate").ToString()) |
|
| 118 | + If reportName.Equals("") Then |
|
| 119 | + reportNames.Add(New Izenda.AdHoc.ReportInfo(reportName, False, createdDate, modifiedDate)) |
|
| 120 | + End If |
|
| 121 | + End While |
|
| 122 | + Catch |
|
| 123 | + End Try |
|
| 124 | + |
|
| 125 | + If command.Connection.State = System.Data.ConnectionState.Open Then command.Connection.Close() |
|
| 126 | + Return DirectCast(reportNames.ToArray(GetType(Izenda.AdHoc.ReportInfo)), Izenda.AdHoc.ReportInfo()) |
|
| 127 | 127 | } |
| 128 | 128 | } |
| 129 | 129 | ``` |
| ... | ... | \ No newline at end of file |