Option Strict Off
Option Explicit On
Imports System.Linq
Imports System.Collections.Generic
Namespace FMStocks_Ext
   Public Class History
   ' the name of this module - used if there is an error
   Private Const g_modName As String = "FMStocks_Ext.History"
   Public Function GetHistory(ByVal Ticker As String) As gmRTL.DataLib.SqlClient.Recordset
      GetHistory = Nothing
      ' the recordset that will be returned
      Dim rs As gmRTL.DataLib.SqlClient.Recordset = Nothing
      ' fmstocks database component
      Dim db As FMStocks_DB.DBHelper = Nothing
      Try
         gmRTL.Core.GlobalException.ClearErrorObject()


         db = New FMStocks_DB.DBHelper

         GetHistory = db.RunSQLReturnRS("select * from History where Ticker = ?",New Object(){FMStocks_DB.Helpers.mp("Ticker",System.Data.SqlDbType.VarChar,12,Ticker)},String.Empty)

         ' done using the fmstocks component
         db = Nothing

         Exit Function

      Catch exc As System.Exception
         gmRTL.Core.GlobalException.SetErrorObject(exc)
         db = Nothing
         rs = Nothing

         ' display the error
         FMStocks_DB.Helpers.RaiseError(g_modName,"History",String.Empty,0,False)
      End Try
   End Function
   End Class
End Namespace
