updaet 20250123

This commit is contained in:
Stefan Hutter
2025-01-24 16:25:47 +01:00
parent 52a3fecee5
commit 608c67d21b
156 changed files with 2055 additions and 1660 deletions

View File

@@ -96,4 +96,37 @@ Public Class VBFileManagement
connection = Nothing
End Function
Public Function Get_Dok_From_DB(ByVal sDokumentID As String, ByVal sDokumentName As String, ByVal connectionstring As String) As Boolean
Dim connection As New SqlConnection()
Dim da As New SqlDataAdapter("Select * From doks where DokumentID='" + sDokumentID + "'", connection)
Dim CB As SqlCommandBuilder = New SqlCommandBuilder(da)
Dim ds As New DataSet()
Try
'Connectionstring zur Datenbank
connection.ConnectionString = connectionstring
connection.Open()
da.Fill(ds, "docs")
Dim myRow As DataRow
myRow = ds.Tables(0).Rows(0)
Dim MyData() As Byte
MyData = myRow.Item(1)
Dim K As Long
K = UBound(MyData)
Dim fs As New FileStream(sDokumentName, FileMode.OpenOrCreate, FileAccess.Write)
fs.Write(MyData, 0, K)
fs.Close()
fs = Nothing
Catch ex As Exception
Return False
End Try
CB = Nothing
ds = Nothing
da = Nothing
connection.Close()
connection = Nothing
Return True
End Function
End Class