Initial commit
This commit is contained in:
56
EDOKA_Toolset/Plugin_Connection/db/clsdb.vb
Normal file
56
EDOKA_Toolset/Plugin_Connection/db/clsdb.vb
Normal file
@@ -0,0 +1,56 @@
|
||||
Imports System.Data.SqlClient
|
||||
Imports System.Data.SqlDbType
|
||||
Imports System.IO
|
||||
Public Class clsdb
|
||||
Dim m_connectionstring As String
|
||||
Property Connectionstring As String
|
||||
Get
|
||||
Return m_connectionstring
|
||||
End Get
|
||||
Set(value As String)
|
||||
m_connectionstring = value
|
||||
End Set
|
||||
End Property
|
||||
|
||||
Public dsdaten As New DataSet
|
||||
Public dadaten As SqlDataAdapter
|
||||
Dim sql As String
|
||||
Sub New()
|
||||
Dim ConnectionFilename As String = "edokaconn.cfg"
|
||||
Dim path As String = ""
|
||||
Dim fc As Integer = 0
|
||||
|
||||
Dim ofile As System.IO.File
|
||||
Dim oread As System.IO.StreamReader
|
||||
Dim sConnectionstring As String
|
||||
oread = ofile.OpenText(ApplicationPath() + "\" + ConnectionFilename)
|
||||
sConnectionstring = oread.ReadLine
|
||||
sConnectionstring = Crypto.DecryptText(sConnectionstring, "HutterundMueller")
|
||||
sConnectionstring = Left(sConnectionstring, Len(sConnectionstring) - 1)
|
||||
sConnectionstring = sConnectionstring
|
||||
oread.Close()
|
||||
Me.Connectionstring = sConnectionstring
|
||||
End Sub
|
||||
|
||||
Public Sub Get_data()
|
||||
Try
|
||||
dsdaten.Clear()
|
||||
sql = "Select * from DBConnection_Umleitung"
|
||||
dadaten = New SqlDataAdapter(sql, Connectionstring)
|
||||
dadaten.Fill(dsdaten, "dbconn")
|
||||
|
||||
Catch
|
||||
End Try
|
||||
End Sub
|
||||
|
||||
Sub Update_Daten()
|
||||
Try
|
||||
Dim cb As New SqlCommandBuilder(dadaten)
|
||||
dadaten.Update(dsdaten, dsdaten.Tables(0).TableName)
|
||||
MsgBox("Änderungen wurden gespeichert")
|
||||
Catch ex As Exception
|
||||
MsgBox("Felher: " + ex.Message)
|
||||
End Try
|
||||
End Sub
|
||||
|
||||
End Class
|
||||
Reference in New Issue
Block a user