Files
EDOKA_DMS/Backup/DataAccess/Klassifizierung.vb
2022-12-25 10:09:49 +01:00

85 lines
2.3 KiB
VB.net

Imports System.Data
Imports System.Data.SqlClient
'''<summary>Datenzugriff auf Tabelle Klassifizierung</summary>
Public Class Klassifizierung
#Region "Public methods"
'''<summary>Gibt eine Liste mit allen Funktionsgrupppen zurück</summary>
'''<param name="ds">Das DataSet welches gefüllt werden soll</param>
Overloads Shared Sub GetListe(ByRef ds As DataSet)
Dim sqlConn As New SqlConnection()
Dim sqlCmd As New SqlCommand()
Dim da As New SqlDataAdapter()
Try
sqlCmd.CommandText = "sp_ListKlassifizierung"
sqlCmd.CommandType = CommandType.StoredProcedure
sqlCmd.Connection = sqlConn
sqlConn.ConnectionString = Common.Datenbank.GetDSN()
sqlConn.Open()
da.SelectCommand = sqlCmd
da.Fill(ds, "KlassifizierungListe")
Catch ex As Exception
Throw ex
Finally
If sqlCmd Is Nothing Then
sqlCmd.Dispose()
End If
If sqlConn Is Nothing Then
sqlConn.Dispose()
End If
If da Is Nothing Then
da.Dispose()
End If
End Try
End Sub
'''<summary>Gibt alle Details zur einer Klassifizierung zurück</summary>
'''<param name="klassifizierungNr">Die Datenbank Nummer der Klassifizierung (ID)</param>
'''<param name="ds">Das zu füllende DataSet</param>
Overloads Shared Sub GetById(ByVal klassifizierungNr As Integer, ByRef ds As DataSet)
Dim sqlConn As New SqlConnection()
Dim sqlCmd As New SqlCommand()
Dim da As New SqlDataAdapter()
Try
sqlCmd.CommandText = "sp_GetKlassifizierungById"
sqlCmd.CommandType = CommandType.StoredProcedure
sqlCmd.Connection = sqlConn
sqlCmd.Parameters.Add(New SqlParameter("@KlassifizierungNr", klassifizierungNr))
sqlConn.ConnectionString = Common.Datenbank.GetDSN()
sqlConn.Open()
da.SelectCommand = sqlCmd
da.Fill(ds, "Klassifizierung")
Catch ex As Exception
Throw ex
Finally
If sqlCmd Is Nothing Then
sqlCmd.Dispose()
End If
If sqlConn Is Nothing Then
sqlConn.Dispose()
End If
If da Is Nothing Then
da.Dispose()
End If
End Try
End Sub
#End Region
End Class