Public Shared Function GetDatasetList(ByVal strMetricName As String, ByVal strInputCode As String, ByVal lstTechCode As List(Of TechnologySet), ByVal intSelectedYear As Integer) As List(Of DataSetClass)
Dim datasetlist As New List(Of DataSetClass)
Dim CnSql As SqlConnection = BadsDB.GetConnection
Dim cmdA As SqlCommand
Dim reader As SqlDataReader = Nothing
cmdA = New SqlClient.SqlCommand("up_GetGraphReportDataset", CnSql)
cmdA.CommandTimeout = 7200
Try
For Each t As TechnologySet In lstTechCode
With cmdA
.CommandType = CommandType.StoredProcedure
.Parameters.AddWithValue("@MetricName", strMetricName.ToString)
.Parameters.AddWithValue("@InputCode", strInputCode.ToString)
.Parameters.AddWithValue("@TechnologySetCode", t.TechnologySetCode.ToString)
.Parameters.AddWithValue("@BudgetYear", intSelectedYear)
End With
If CnSql.State = ConnectionState.Closed Then
CnSql.Open()
End If
reader = cmdA.ExecuteReader(CommandBehavior.CloseConnection)
Dim DataVersionIdOrd As Integer = reader.GetOrdinal("DataVersionId")
Dim dsc As DataSetClass
Do While reader.Read
dsc = New DataSetClass
dsc.DataVersionId = reader.GetString(DataVersionIdOrd)
datasetlist.Add(dsc)
Loop
Next
reader.Close()
Catch excA As SqlException
MsgBox(excA.Message, excA.GetType.ToString)
Finally
CnSql.Close()
End Try
Return datasetlist
End Function
|