update 20241125

This commit is contained in:
Stefan Hutter
2024-11-24 19:38:37 +01:00
parent 6bdbc4173e
commit 341ea50f06
281 changed files with 14362 additions and 180 deletions

View File

@@ -61,4 +61,39 @@ Public Class VBFileManagement
Connection = Nothing
End Function
Public Function Get_From_DB(ByVal office_vorlagenr As Integer, ByVal filename As String, ByVal connectionstring As String, Optional ByVal Office2010_Vorlage As Boolean = False) As String
Dim connection As New SqlConnection()
Dim s As String = "Select * From office_vorlage_datei where office_vorlage_Dateinr=" + Trim(Str(office_vorlagenr))
If Office2010_Vorlage = True Then
s = "Select * from Office2010_Vorlage_datei where office_vorlage_dateinr=" + Trim(Str(office_vorlagenr))
End If
Dim da As New SqlDataAdapter(s, connection)
Dim CB As SqlCommandBuilder = New SqlCommandBuilder(da)
Dim ds As New DataSet()
Try
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(2)
Dim K As Long
K = UBound(MyData)
Dim fs As New FileStream(filename, FileMode.OpenOrCreate, FileAccess.Write)
fs.Write(MyData, 0, K)
fs.Close()
fs = Nothing
Return filename
Catch ex As Exception
MsgBox(ex.Message)
End Try
CB = Nothing
ds = Nothing
da = Nothing
connection.Close()
connection = Nothing
End Function
End Class