Imports System.Data Imports System.Data.SqlTypes Imports System.Data.SqlClient Imports System.ComponentModel Public Class FrmIndexMutation Inherits System.Windows.Forms.Form Dim m_dokumentid As String Property Dokumentid() As String Get Return m_dokumentid End Get Set(ByVal Value As String) m_dokumentid = Value End Set End Property Dim daten As New DataTable() Dim dokumente As New DataTable() Dim partnernr As String Dim datum As DateTime Dim vvnr As String Dim gf As String Dim gu As String #Region " Vom Windows Form Designer generierter Code " Public Sub New() MyBase.New() ' Dieser Aufruf ist für den Windows Form-Designer erforderlich. InitializeComponent() ' Initialisierungen nach dem Aufruf InitializeComponent() hinzufügen End Sub ' Die Form überschreibt den Löschvorgang der Basisklasse, um Komponenten zu bereinigen. Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean) If disposing Then If Not (components Is Nothing) Then components.Dispose() End If End If MyBase.Dispose(disposing) End Sub ' Für Windows Form-Designer erforderlich Private components As System.ComponentModel.IContainer 'HINWEIS: Die folgende Prozedur ist für den Windows Form-Designer erforderlich 'Sie kann mit dem Windows Form-Designer modifiziert werden. 'Verwenden Sie nicht den Code-Editor zur Bearbeitung. Friend WithEvents TextBox1 As System.Windows.Forms.TextBox Friend WithEvents Label1 As System.Windows.Forms.Label Friend WithEvents DateTimePicker1 As System.Windows.Forms.DateTimePicker Friend WithEvents Label2 As System.Windows.Forms.Label Friend WithEvents Label3 As System.Windows.Forms.Label Friend WithEvents Label4 As System.Windows.Forms.Label Friend WithEvents TextBox2 As System.Windows.Forms.TextBox Friend WithEvents TextBox3 As System.Windows.Forms.TextBox Friend WithEvents Label5 As System.Windows.Forms.Label Friend WithEvents TextBox4 As System.Windows.Forms.TextBox Friend WithEvents Button1 As System.Windows.Forms.Button Friend WithEvents Button2 As System.Windows.Forms.Button Friend WithEvents Button3 As System.Windows.Forms.Button Friend WithEvents Button4 As System.Windows.Forms.Button Private Sub InitializeComponent() Dim resources As System.Resources.ResourceManager = New System.Resources.ResourceManager(GetType(FrmIndexMutation)) Me.TextBox1 = New System.Windows.Forms.TextBox() Me.Label1 = New System.Windows.Forms.Label() Me.DateTimePicker1 = New System.Windows.Forms.DateTimePicker() Me.Label2 = New System.Windows.Forms.Label() Me.Label3 = New System.Windows.Forms.Label() Me.Label4 = New System.Windows.Forms.Label() Me.TextBox2 = New System.Windows.Forms.TextBox() Me.TextBox3 = New System.Windows.Forms.TextBox() Me.Label5 = New System.Windows.Forms.Label() Me.TextBox4 = New System.Windows.Forms.TextBox() Me.Button1 = New System.Windows.Forms.Button() Me.Button2 = New System.Windows.Forms.Button() Me.Button3 = New System.Windows.Forms.Button() Me.Button4 = New System.Windows.Forms.Button() Me.SuspendLayout() ' 'TextBox1 ' Me.TextBox1.Location = New System.Drawing.Point(160, 16) Me.TextBox1.Name = "TextBox1" Me.TextBox1.ReadOnly = True Me.TextBox1.Size = New System.Drawing.Size(120, 20) Me.TextBox1.TabIndex = 0 Me.TextBox1.Text = "" ' 'Label1 ' Me.Label1.Location = New System.Drawing.Point(16, 16) Me.Label1.Name = "Label1" Me.Label1.Size = New System.Drawing.Size(64, 23) Me.Label1.TabIndex = 1 Me.Label1.Text = "Partner-Nr." ' 'DateTimePicker1 ' Me.DateTimePicker1.Format = System.Windows.Forms.DateTimePickerFormat.Short Me.DateTimePicker1.Location = New System.Drawing.Point(160, 64) Me.DateTimePicker1.Name = "DateTimePicker1" Me.DateTimePicker1.Size = New System.Drawing.Size(120, 20) Me.DateTimePicker1.TabIndex = 2 ' 'Label2 ' Me.Label2.Location = New System.Drawing.Point(16, 64) Me.Label2.Name = "Label2" Me.Label2.Size = New System.Drawing.Size(80, 23) Me.Label2.TabIndex = 3 Me.Label2.Text = "Archiv-Datum" ' 'Label3 ' Me.Label3.Location = New System.Drawing.Point(16, 88) Me.Label3.Name = "Label3" Me.Label3.Size = New System.Drawing.Size(80, 23) Me.Label3.TabIndex = 4 Me.Label3.Text = "Geschäftsfall" ' 'Label4 ' Me.Label4.Location = New System.Drawing.Point(16, 112) Me.Label4.Name = "Label4" Me.Label4.Size = New System.Drawing.Size(136, 23) Me.Label4.TabIndex = 5 Me.Label4.Text = "Grundstück-Bezeichnung" ' 'TextBox2 ' Me.TextBox2.Location = New System.Drawing.Point(160, 88) Me.TextBox2.Name = "TextBox2" Me.TextBox2.Size = New System.Drawing.Size(120, 20) Me.TextBox2.TabIndex = 6 Me.TextBox2.Text = "" ' 'TextBox3 ' Me.TextBox3.Location = New System.Drawing.Point(160, 112) Me.TextBox3.Name = "TextBox3" Me.TextBox3.Size = New System.Drawing.Size(120, 20) Me.TextBox3.TabIndex = 7 Me.TextBox3.Text = "" ' 'Label5 ' Me.Label5.Location = New System.Drawing.Point(16, 40) Me.Label5.Name = "Label5" Me.Label5.Size = New System.Drawing.Size(88, 23) Me.Label5.TabIndex = 9 Me.Label5.Text = "VV-Nummer" ' 'TextBox4 ' Me.TextBox4.Location = New System.Drawing.Point(160, 40) Me.TextBox4.Name = "TextBox4" Me.TextBox4.ReadOnly = True Me.TextBox4.Size = New System.Drawing.Size(120, 20) Me.TextBox4.TabIndex = 8 Me.TextBox4.Text = "" ' 'Button1 ' Me.Button1.Image = CType(resources.GetObject("Button1.Image"), System.Drawing.Bitmap) Me.Button1.Location = New System.Drawing.Point(280, 16) Me.Button1.Name = "Button1" Me.Button1.Size = New System.Drawing.Size(24, 23) Me.Button1.TabIndex = 15 ' 'Button2 ' Me.Button2.Location = New System.Drawing.Point(280, 40) Me.Button2.Name = "Button2" Me.Button2.Size = New System.Drawing.Size(24, 23) Me.Button2.TabIndex = 16 ' 'Button3 ' Me.Button3.Location = New System.Drawing.Point(280, 152) Me.Button3.Name = "Button3" Me.Button3.TabIndex = 17 Me.Button3.Text = "OK" ' 'Button4 ' Me.Button4.Location = New System.Drawing.Point(16, 152) Me.Button4.Name = "Button4" Me.Button4.TabIndex = 18 Me.Button4.Text = "&Abbruch" ' 'FrmIndexMutation ' Me.AutoScaleBaseSize = New System.Drawing.Size(5, 13) Me.ClientSize = New System.Drawing.Size(360, 183) Me.Controls.AddRange(New System.Windows.Forms.Control() {Me.Button4, Me.Button3, Me.Button2, Me.Button1, Me.Label5, Me.TextBox4, Me.TextBox3, Me.TextBox2, Me.Label4, Me.Label3, Me.Label2, Me.DateTimePicker1, Me.Label1, Me.TextBox1}) Me.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle Me.Icon = CType(resources.GetObject("$this.Icon"), System.Drawing.Icon) Me.MaximizeBox = False Me.MinimizeBox = False Me.Name = "FrmIndexMutation" Me.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen Me.Text = "Indexmutation" Me.ResumeLayout(False) End Sub #End Region Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load Dim i As Integer Dim s As String daten = get_dokumentdaten() dokumente = get_dokumente Me.TextBox1.Text = Me.partnernr For i = 0 To daten.Rows.Count - 1 Select Case daten.Rows(i).Item("cold_indexfeldnr") Case 1 Me.TextBox1.Text = RTrim(daten.Rows(i).Item("wert")) partnernr = Me.TextBox1.Text Case 3 Me.TextBox4.Text = RTrim(daten.Rows(i).Item("wert")) Me.vvnr = Me.TextBox4.Text Case 5 s = daten.Rows(i).Item("wert") If Microsoft.VisualBasic.InStr(s, ".") > 0 Then datum = s Else datum = Microsoft.VisualBasic.Right(s, 2) + "." + Mid(s, 5, 2) + "." + Microsoft.VisualBasic.Left(s, 4) End If Me.DateTimePicker1.Value = datum Case 14 Me.TextBox2.Text = RTrim(daten.Rows(i).Item("wert")) Me.gf = Me.TextBox2.Text Case 12 Me.TextBox2.Text = RTrim(daten.Rows(i).Item("wert")) Me.gf = Me.TextBox2.Text Case 17 Me.TextBox3.Text = RTrim(daten.Rows(i).Item("wert")) Me.gu = Me.TextBox3.Text End Select Next End Sub Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button4.Click Me.Close() End Sub Private Function get_dokumentdaten() As DataTable Dim scmCmdToExecute As SqlCommand = New SqlCommand() Dim i As Integer Dim dtToReturn As DataTable = New DataTable() Dim sdaAdapter As SqlDataAdapter = New SqlDataAdapter(scmCmdToExecute) scmCmdToExecute.CommandText = "dbo.sp_indexmutation_getdokinfo" scmCmdToExecute.CommandType = CommandType.StoredProcedure scmCmdToExecute.Connection = conn.scoDBConnection Try scmCmdToExecute.Parameters.Add(New SqlParameter("@dokumentid", SqlDbType.VarChar, 22, ParameterDirection.Input, True, 10, 0, "", DataRowVersion.Proposed, Me.Dokumentid)) sdaAdapter.Fill(dtToReturn) Return dtToReturn Catch ex As Exception MsgBox(ex.Message) Finally scmCmdToExecute.Dispose() sdaAdapter.Dispose() End Try End Function Private Function get_dokumente() As DataTable Dim scmCmdToExecute As SqlCommand = New SqlCommand() Dim i As Integer Dim dtToReturn As DataTable = New DataTable() Dim sdaAdapter As SqlDataAdapter = New SqlDataAdapter(scmCmdToExecute) scmCmdToExecute.CommandText = "dbo.sp_indexmutation_getdokumente" scmCmdToExecute.CommandType = CommandType.StoredProcedure scmCmdToExecute.Connection = conn.scoDBConnection Try scmCmdToExecute.Parameters.Add(New SqlParameter("@dokumentid", SqlDbType.VarChar, 22, ParameterDirection.Input, True, 10, 0, "", DataRowVersion.Proposed, Me.Dokumentid)) sdaAdapter.Fill(dtToReturn) Return dtToReturn Catch ex As Exception MsgBox(ex.Message) Finally scmCmdToExecute.Dispose() sdaAdapter.Dispose() End Try End Function Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click Dim f As New FrmPartnersuche() f.NurAbfrage = True f.ShowDialog() If f.PartnerNr <> 0 Then Me.Cursor = Cursors.WaitCursor Me.TextBox1.Text = f.PartnerNr Me.Cursor = Cursors.Default MyMsg.show_standardmessage(94, MsgBoxStyle.Information) End If End Sub Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click Dim f As New frmValueSelector() f.Text = "Auswahl VV-Nummer" f.Datenherkunft = "&VVdesPartners&" f.Datenherkunft = "&VVunformatiert&" f.Partnernr = Me.TextBox1.Text f.LoadData() If f.Datenvorhanden = True Then f.ShowDialog() If f.DialogResult = DialogResult.OK Then Me.TextBox4.Text = f.SelWert End If f.Dispose() End Sub Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click If Me.partnernr <> Me.TextBox1.Text Then Update_Partnernr(Me.Dokumentid, Me.TextBox1.Text) End If If Me.vvnr <> Me.TextBox4.Text Then Update_vvnr(Dokumentid, Me.TextBox4.Text) End If If Me.gu <> Me.TextBox3.Text Then Update_gu(Dokumentid, Me.TextBox3.Text) End If If Me.gf <> Me.TextBox2.Text Then Update_gf(Me.Dokumentid, Me.TextBox2.Text) End If If Me.datum <> Me.DateTimePicker1.Value Then Update_datum(Dokumentid, Me.datum, Me.DateTimePicker1.Value) End If MyMsg.show_standardmessage(95, MsgBoxStyle.Information) Me.Close() End Sub Public Sub Update_Status(ByVal dokumentid As String, ByVal colddokumentid As String, ByVal indextyp As Integer, ByVal status As String) Dim ityp As Integer If indextyp = 0 Then ityp = get_indextyp(dokumentid, colddokumentid) Else ityp = indextyp End If Insert_ColdUpdate(dokumentid, colddokumentid, ityp, 7, status) Update_DokumentColdIndexwert(dokumentid, ityp, 7, status) End Sub Public Sub Update_Partnernr(ByVal dokumentid As String, ByVal partnernr As String) Dim d As New edokadb.clsDokument() Dim kurzname As String Dim ort As String d.cpMainConnectionProvider = Globals.conn d.sDokumentid = New SqlString(CType(dokumentid, String)) d.SelectOne() d.iNrpar00 = New SqlInt32(CType(partnernr, Int32)) conn.OpenConnection() d.Update() conn.CloseConnection(True) d.Dispose() kurzname = get_data("&PartnerKurzname&") ort = get_data("&PartnerInhaberOrt&") Dim i As Integer For i = 0 To Me.dokumente.Rows.Count - 1 Insert_ColdUpdate(dokumentid, RTrim(dokumente.Rows(i).Item("wert")), dokumente.Rows(i).Item("indextyp"), 1, partnernr) Update_DokumentColdIndexwert(dokumentid, dokumente.Rows(i).Item("indextyp"), 1, Me.TextBox1.Text) Insert_ColdUpdate(dokumentid, RTrim(dokumente.Rows(i).Item("wert")), dokumente.Rows(i).Item("indextyp"), 2, kurzname) Update_DokumentColdIndexwert(dokumentid, dokumente.Rows(i).Item("indextyp"), 2, kurzname) Insert_ColdUpdate(dokumentid, RTrim(dokumente.Rows(i).Item("wert")), dokumente.Rows(i).Item("indextyp"), 8, ort) Update_DokumentColdIndexwert(dokumentid, dokumente.Rows(i).Item("indextyp"), 8, ort) Next End Sub Public Sub Update_vvnr(ByVal dokumentid As String, ByVal vvnr As String) Dim i As Integer For i = 0 To Me.dokumente.Rows.Count - 1 Insert_ColdUpdate(dokumentid, RTrim(dokumente.Rows(i).Item("wert")), dokumente.Rows(i).Item("indextyp"), 3, vvnr) Update_DokumentColdIndexwert(dokumentid, dokumente.Rows(i).Item("indextyp"), 3, vvnr) Next End Sub Public Sub Update_gu(ByVal dokumentid As String, ByVal gu As String) Dim i As Integer For i = 0 To Me.dokumente.Rows.Count - 1 Insert_ColdUpdate(dokumentid, RTrim(dokumente.Rows(i).Item("wert")), dokumente.Rows(i).Item("indextyp"), 17, gu) Update_DokumentColdIndexwert(dokumentid, dokumente.Rows(i).Item("indextyp"), 17, gu) Next End Sub Public Sub Update_gf(ByVal dokumentid As String, ByVal gf As String) Dim i As Integer For i = 0 To Me.dokumente.Rows.Count - 1 Insert_ColdUpdate(dokumentid, RTrim(dokumente.Rows(i).Item("wert")), dokumente.Rows(i).Item("indextyp"), 14, gf) Update_DokumentColdIndexwert(dokumentid, dokumente.Rows(i).Item("indextyp"), 14, gf) Update_DokumentColdIndexwert(dokumentid, dokumente.Rows(i).Item("indextyp"), 12, gf) Next End Sub Public Sub Update_datum(ByVal dokumentid As String, ByVal datuma As DateTime, ByVal datum As DateTime) Dim i As Integer Dim alterwert As String Dim neuerwert As String Dim s As String alterwert = LTrim(Str(Year(datuma))) s = LTrim(Str(Month(datuma))) While Len(s) < 2 s = "0" + s End While alterwert = alterwert + s s = LTrim(Str(Microsoft.VisualBasic.Day(datuma))) While Len(s) < 2 s = "0" + s End While alterwert = alterwert + s neuerwert = LTrim(Str(Year(datum))) s = LTrim(Str(Month(datum))) While Len(s) < 2 s = "0" + s End While neuerwert = neuerwert + s s = LTrim(Str(Microsoft.VisualBasic.Day(datum))) While Len(s) < 2 s = "0" + s End While neuerwert = neuerwert + s For i = 0 To Me.dokumente.Rows.Count - 1 Insert_ColdUpdate_Datum(dokumentid, RTrim(dokumente.Rows(i).Item("wert")), alterwert, neuerwert) Update_DokumentColdIndexwert(dokumentid, dokumente.Rows(i).Item("indextyp"), 5, neuerwert) Next End Sub Public Function Insert_ColdUpdate(ByVal dokumentid As String, ByVal colddokumentid As String, ByVal indextyp As Integer, ByVal feldnr As Integer, ByVal wert As String) Dim scmCmdToExecute As SqlCommand = New SqlCommand() scmCmdToExecute.CommandText = "dbo.SP_Archiv_insert_coldupdate" scmCmdToExecute.CommandType = CommandType.StoredProcedure Dim dtToReturn As DataTable = New DataTable() conn.OpenConnection() Dim sdaAdapter As SqlDataAdapter = New SqlDataAdapter(scmCmdToExecute) scmCmdToExecute.Parameters.Add(New SqlParameter("@dokumentid", SqlDbType.VarChar, 22, ParameterDirection.Input, True, 10, 0, "", DataRowVersion.Proposed, dokumentid)) scmCmdToExecute.Parameters.Add(New SqlParameter("@colddokumentid", SqlDbType.VarChar, 255, ParameterDirection.Input, True, 10, 0, "", DataRowVersion.Proposed, colddokumentid)) scmCmdToExecute.Parameters.Add(New SqlParameter("@indextyp", SqlDbType.Int, 4, ParameterDirection.Input, True, 10, 0, "", DataRowVersion.Proposed, indextyp)) scmCmdToExecute.Parameters.Add(New SqlParameter("@feldnr", SqlDbType.Int, 4, ParameterDirection.Input, True, 10, 0, "", DataRowVersion.Proposed, feldnr)) scmCmdToExecute.Parameters.Add(New SqlParameter("@neuerwert", SqlDbType.VarChar, 255, ParameterDirection.Input, True, 10, 0, "", DataRowVersion.Proposed, wert)) scmCmdToExecute.Connection = conn.scoDBConnection Try sdaAdapter.Fill(dtToReturn) Return dtToReturn Catch ex As Exception MsgBox(ex.Message) Finally scmCmdToExecute.Dispose() sdaAdapter.Dispose() conn.CloseConnection(True) End Try End Function Public Function Insert_ColdUpdate_Datum(ByVal dokumentid As String, ByVal colddokumentid As String, ByVal alterwert As String, ByVal neuerwert As String) Dim scmCmdToExecute As SqlCommand = New SqlCommand() scmCmdToExecute.CommandText = "dbo.sp_indexmutation_insert_datumupdate" scmCmdToExecute.CommandType = CommandType.StoredProcedure Dim dtToReturn As DataTable = New DataTable() conn.OpenConnection() Dim sdaAdapter As SqlDataAdapter = New SqlDataAdapter(scmCmdToExecute) scmCmdToExecute.Parameters.Add(New SqlParameter("@dokumentid", SqlDbType.VarChar, 22, ParameterDirection.Input, True, 10, 0, "", DataRowVersion.Proposed, dokumentid)) scmCmdToExecute.Parameters.Add(New SqlParameter("@colddokumentid", SqlDbType.VarChar, 255, ParameterDirection.Input, True, 10, 0, "", DataRowVersion.Proposed, colddokumentid)) scmCmdToExecute.Parameters.Add(New SqlParameter("@alterwert", SqlDbType.VarChar, 255, ParameterDirection.Input, True, 10, 0, "", DataRowVersion.Proposed, alterwert)) scmCmdToExecute.Parameters.Add(New SqlParameter("@neuerwert", SqlDbType.VarChar, 255, ParameterDirection.Input, True, 10, 0, "", DataRowVersion.Proposed, neuerwert)) scmCmdToExecute.Connection = conn.scoDBConnection Try sdaAdapter.Fill(dtToReturn) Return dtToReturn Catch ex As Exception MsgBox(ex.Message) Finally scmCmdToExecute.Dispose() sdaAdapter.Dispose() conn.CloseConnection(True) End Try End Function Public Function Update_DokumentColdIndexwert(ByVal dokumentid As String, ByVal Indextyp As Integer, ByVal indexfeld As Integer, ByVal wert As String) Dim scmCmdToExecute As SqlCommand = New SqlCommand() scmCmdToExecute.CommandText = "dbo.SP_Archiv_Update_DokumentColdIndexwert" scmCmdToExecute.CommandType = CommandType.StoredProcedure Dim dtToReturn As DataTable = New DataTable() conn.OpenConnection() Dim sdaAdapter As SqlDataAdapter = New SqlDataAdapter(scmCmdToExecute) scmCmdToExecute.Parameters.Add(New SqlParameter("@dokumentid", SqlDbType.VarChar, 255, ParameterDirection.Input, True, 10, 0, "", DataRowVersion.Proposed, dokumentid)) scmCmdToExecute.Parameters.Add(New SqlParameter("@indextyp", SqlDbType.Int, 4, ParameterDirection.Input, True, 10, 0, "", DataRowVersion.Proposed, Indextyp)) scmCmdToExecute.Parameters.Add(New SqlParameter("@indexfeld", SqlDbType.Int, 4, ParameterDirection.Input, True, 10, 0, "", DataRowVersion.Proposed, indexfeld)) scmCmdToExecute.Parameters.Add(New SqlParameter("@wert", SqlDbType.VarChar, 255, ParameterDirection.Input, True, 10, 0, "", DataRowVersion.Proposed, wert)) scmCmdToExecute.Connection = conn.scoDBConnection Try sdaAdapter.Fill(dtToReturn) Return dtToReturn Catch ex As Exception ' // some error occured. Bubble it to caller and encapsulate Exception object Throw New Exception("Dokumenterstellung::Generic_Select::" & scmCmdToExecute.CommandText & "::Error occured." & ex.Message, ex) Finally scmCmdToExecute.Dispose() sdaAdapter.Dispose() conn.CloseConnection(True) End Try End Function Private Function get_data(ByVal datenherkunft As String) As String Dim scmCmdToExecute As SqlCommand = New SqlCommand() Dim i As Integer Dim dtToReturn As DataTable = New DataTable() Dim sdaAdapter As SqlDataAdapter = New SqlDataAdapter(scmCmdToExecute) scmCmdToExecute.CommandText = "dbo.sp_dokumentwerte_select" scmCmdToExecute.CommandType = CommandType.StoredProcedure scmCmdToExecute.Connection = conn.scoDBConnection Try scmCmdToExecute.Parameters.Add(New SqlParameter("@datenherkunft", SqlDbType.VarChar, 255, ParameterDirection.Input, True, 10, 0, "", DataRowVersion.Proposed, datenherkunft)) scmCmdToExecute.Parameters.Add(New SqlParameter("@dokumentid", SqlDbType.VarChar, 22, ParameterDirection.Input, True, 10, 0, "", DataRowVersion.Proposed, Me.Dokumentid)) scmCmdToExecute.Parameters.Add(New SqlParameter("@value", SqlDbType.VarChar, 255, ParameterDirection.Output, True, 10, 0, "", DataRowVersion.Proposed, "")) sdaAdapter.Fill(dtToReturn) Return scmCmdToExecute.Parameters("@value").Value Catch ex As Exception MsgBox(ex.Message) Finally scmCmdToExecute.Dispose() sdaAdapter.Dispose() End Try End Function Private Function get_indextyp(ByVal dokumentid As String, ByVal colddokumentid As String) As Integer Dim scmCmdToExecute As SqlCommand = New SqlCommand() Dim i As Integer Dim dtToReturn As DataTable = New DataTable() Dim sdaAdapter As SqlDataAdapter = New SqlDataAdapter(scmCmdToExecute) scmCmdToExecute.CommandText = "dbo.sp_indexmutation_getindextyp" scmCmdToExecute.CommandType = CommandType.StoredProcedure scmCmdToExecute.Connection = conn.scoDBConnection Try scmCmdToExecute.Parameters.Add(New SqlParameter("@dokumentid", SqlDbType.VarChar, 255, ParameterDirection.Input, True, 10, 0, "", DataRowVersion.Proposed, dokumentid)) scmCmdToExecute.Parameters.Add(New SqlParameter("@colddokumentid", SqlDbType.VarChar, 255, ParameterDirection.Input, True, 10, 0, "", DataRowVersion.Proposed, colddokumentid)) scmCmdToExecute.Parameters.Add(New SqlParameter("@indextyp", SqlDbType.Int, 4, ParameterDirection.Output, True, 10, 0, "", DataRowVersion.Proposed, 0)) sdaAdapter.Fill(dtToReturn) Return scmCmdToExecute.Parameters("@indextyp").Value Catch ex As Exception MsgBox(ex.Message) Finally scmCmdToExecute.Dispose() sdaAdapter.Dispose() End Try End Function End Class