You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
100 lines
4.0 KiB
100 lines
4.0 KiB
Imports System.IO.File
|
|
Imports System.Data.SqlClient
|
|
Imports System.Data.SqlTypes
|
|
Imports System.ComponentModel
|
|
Imports System.SystemException
|
|
Imports System.Threading
|
|
|
|
Public Class clsJournal
|
|
Dim m_protokolltyp As Integer
|
|
Property ProtokollTyp() As Integer
|
|
Get
|
|
Return m_protokolltyp
|
|
End Get
|
|
Set(ByVal Value As Integer)
|
|
m_protokolltyp = Value
|
|
End Set
|
|
End Property
|
|
|
|
Dim m_objekt As String
|
|
Property Objekt() As String
|
|
Get
|
|
Return m_objekt
|
|
End Get
|
|
Set(ByVal Value As String)
|
|
m_objekt = Value
|
|
End Set
|
|
End Property
|
|
|
|
Dim m_ereignis As String
|
|
Property Ereignis() As String
|
|
Get
|
|
Return m_ereignis
|
|
End Get
|
|
Set(ByVal Value As String)
|
|
m_ereignis = Value
|
|
End Set
|
|
End Property
|
|
|
|
Dim m_id As String
|
|
Property IDBez() As String
|
|
Get
|
|
Return m_id
|
|
End Get
|
|
Set(ByVal Value As String)
|
|
m_id = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Function Journaleintrag(ByVal typ As Integer, ByVal tablename As String, ByVal keyfeld As String, ByVal keyvalue As String, ByVal ereignis As String, ByVal where As String, ByVal obj As String, ByVal idvalue As String)
|
|
Dim inpdata As New DataSet()
|
|
Dim i As Integer
|
|
Dim o As Integer
|
|
|
|
Select Case typ
|
|
Case 1
|
|
Dim inp As New SqlDataAdapter("Select * from " & tablename, Globals.sConnectionString)
|
|
inp.Fill(inpdata, "Table1")
|
|
Case 2
|
|
Dim inp As New SqlDataAdapter("select * from " & tablename & where, Globals.sConnectionString)
|
|
inp.Fill(inpdata, "Table1")
|
|
Case 3
|
|
Dim inp As New SqlDataAdapter("Select * from " & tablename & " where " & keyfeld & " = " & keyvalue, Globals.sConnectionString)
|
|
inp.Fill(inpdata, "Table1")
|
|
Case Else
|
|
End Select
|
|
|
|
|
|
|
|
For i = 0 To inpdata.Tables(0).Rows.Count - 1
|
|
For o = 0 To inpdata.Tables(0).Columns.Count - 1
|
|
Dim scmCmdToExecute As SqlCommand = New SqlCommand()
|
|
scmCmdToExecute.CommandText = "dbo.SP_Revisionsjournal_Insert"
|
|
scmCmdToExecute.CommandType = CommandType.StoredProcedure
|
|
|
|
Try
|
|
scmCmdToExecute.Connection = conn.scoDBConnection
|
|
conn.OpenConnection()
|
|
scmCmdToExecute.Parameters.Add(New SqlParameter("@ereignis", SqlDbType.VarChar, 255, ParameterDirection.Input, True, 10, 0, "", DataRowVersion.Proposed, ereignis))
|
|
scmCmdToExecute.Parameters.Add(New SqlParameter("@objekt", SqlDbType.VarChar, 255, ParameterDirection.Input, True, 10, 0, "", DataRowVersion.Proposed, obj))
|
|
scmCmdToExecute.Parameters.Add(New SqlParameter("@id", SqlDbType.VarChar, 255, ParameterDirection.Input, True, 10, 0, "", DataRowVersion.Proposed, idvalue))
|
|
scmCmdToExecute.Parameters.Add(New SqlParameter("@feld", SqlDbType.VarChar, 255, ParameterDirection.Input, True, 10, 0, "", DataRowVersion.Proposed, inpdata.Tables(0).Columns(o).ColumnName))
|
|
If inpdata.Tables(0).Rows(i).Item(o) Is System.DBNull.Value Then
|
|
scmCmdToExecute.Parameters.Add(New SqlParameter("@value", SqlDbType.VarChar, 255, ParameterDirection.Input, True, 10, 0, "", DataRowVersion.Proposed, "<NULL>"))
|
|
Else
|
|
scmCmdToExecute.Parameters.Add(New SqlParameter("@value", SqlDbType.VarChar, 255, ParameterDirection.Input, True, 10, 0, "", DataRowVersion.Proposed, CType(inpdata.Tables(0).Rows(i).Item(o), String)))
|
|
End If
|
|
scmCmdToExecute.ExecuteNonQuery()
|
|
conn.CloseConnection(True)
|
|
Catch ex As Exception
|
|
MsgBox(ex.Message)
|
|
Finally
|
|
scmCmdToExecute.Dispose()
|
|
End Try
|
|
Next
|
|
Next
|
|
inpdata.Dispose()
|
|
End Function
|
|
|
|
End Class
|