Collapse All Expand All Language Filter: Code: All Code: Multiple Code: Visual Basic Code: C# Code: Visual C++ Code: J# Code: JScript

EDKB12WS Reference
ModMain.Save_To_DB Method
See Also

Assembly: EDKB12WS (in EDKB12WS.exe)

# Syntax

Visual Basic
Public Shared Function Save_To_DB( _ ByVal sDokumentID As String, _ ByVal sDokumentName As String _ ) As Boolean
C#
public static bool Save_To_DB( string sDokumentID, string sDokumentName )
C++
public: static bool Save_To_DB( String^ sDokumentID, String^ sDokumentName )
JScript
public static function Save_To_DB( sDokumentID : String, sDokumentName : String ) : boolean;
## Parameters sDokumentID sDokumentName

# Source code

Visual Basic | Copy Code
Public Function Save_To_DB(ByVal sDokumentID As String, ByVal sDokumentName As String) As Boolean If Param.DebugMode Then DivFnkt.InsertJournale("EDKB12: Start Save_To_DB", clsDivFnkt.Enum_InfoTyp.Information) End If Try Dim Connection As New SqlConnection() Dim DA As New SqlDataAdapter("select * from doks where dokumentid='" + Dokumentid + "'", Connection) Dim cb As SqlCommandBuilder = New SqlCommandBuilder(DA) Dim ds As New DataSet() Dim fs As New FileStream(DokumentFilename, FileMode.Open, FileAccess.Read) Dim mydata(fs.Length) As Byte Try fs.Read(mydata, 0, fs.Length) fs.Close() Connection.ConnectionString = Param.connectionstring Connection.Open() DA.Fill(ds, "docs") Dim myRow As DataRow If ds.Tables(0).Rows.Count = 0 Then ' Neues Dokument speichern myRow = ds.Tables(0).NewRow myRow.Item(0) = Dokumentid myRow.Item(1) = mydata ds.Tables(0).Rows.Add(myRow) DA.Update(ds, "docs") Else 'Bestehendes Dokument sichenr myRow = ds.Tables(0).Rows(0) myRow.Item(1) = mydata DA.Update(ds, "docs") End If Catch ex As Exception Return False End Try fs = Nothing cb = Nothing ds = Nothing DA = Nothing Connection.Close() Connection = Nothing If Param.DebugMode Then DivFnkt.InsertJournale("EDKB12: Ende Save_To_DB (True)", clsDivFnkt.Enum_InfoTyp.Information) End If Return True Catch EX As Exception DivFnkt.InsertJournale("EDKB12::Fehler:: Save_To_DB::" & EX.Message, clsDivFnkt.Enum_InfoTyp.Fehler) If Param.DebugMode Then DivFnkt.InsertJournale("EDKB12: Ende Save_To_DB (False)::" & EX.Message, clsDivFnkt.Enum_InfoTyp.Information) End If Return False End Try End Function

# Platforms

Windows 8, Windows Server 2012, Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows XP SP2 x64 Edition, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2 The .NET Framework does not support all versions of every platform. For a list of the supported versions, see System Requirements.

# Version Information

## .NET Framework Supported in: 4.5, 4, 3.5, 3.0, 2.0, 1.1, 1.0 ## .NET Compact Framework Supported in: 3.5, 2.0, 1.0 ## XNA Framework Supported in: 3.0, 2.0, 1.0

# See Also

## Reference ModMain Class ModMain ModMain Members