updaet 20250123
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user