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