WIP: EDM Designer, Create Tables

This commit is contained in:
Jonathan Jenne 2018-09-03 17:24:17 +02:00
parent ae0bb16dc8
commit a2e233fe68
13 changed files with 490 additions and 174 deletions

View File

@ -7,9 +7,9 @@ Public Class ClassCurrentUser
Private DBFirebird As Firebird Private DBFirebird As Firebird
Public Sub New(DBFirebird As Firebird) Public Sub New(DBFirebird As Firebird)
Username = Environment.UserName 'Username = Environment.UserName
Dim sql As String = $"SELECT FNGET_USER_ACCESS('edm','{Username}') FROM rdb$database" 'Dim sql As String = $"SELECT FNGET_USER_ACCESS('edm','{Username}') FROM rdb$database"
Dim result = DBFirebird.GetExecuteScalar(sql) 'Dim result = DBFirebird.GetScalarValue(sql)
End Sub End Sub
End Class End Class

View File

@ -75,9 +75,6 @@
<HintPath>..\packages\FirebirdSql.Data.FirebirdClient.6.1.0\lib\net452\FirebirdSql.Data.FirebirdClient.dll</HintPath> <HintPath>..\packages\FirebirdSql.Data.FirebirdClient.6.1.0\lib\net452\FirebirdSql.Data.FirebirdClient.dll</HintPath>
</Reference> </Reference>
<Reference Include="Microsoft.CSharp" /> <Reference Include="Microsoft.CSharp" />
<Reference Include="Modules.Database">
<HintPath>..\Modules.Database\bin\Debug\DigitalData.Modules.Database.dll</HintPath>
</Reference>
<Reference Include="NLog, Version=4.0.0.0, Culture=neutral, PublicKeyToken=5120e14c03d0593c, processorArchitecture=MSIL"> <Reference Include="NLog, Version=4.0.0.0, Culture=neutral, PublicKeyToken=5120e14c03d0593c, processorArchitecture=MSIL">
<HintPath>..\packages\NLog.4.5.8\lib\net45\NLog.dll</HintPath> <HintPath>..\packages\NLog.4.5.8\lib\net45\NLog.dll</HintPath>
</Reference> </Reference>
@ -128,6 +125,12 @@
<DependentUpon>FrmMain.vb</DependentUpon> <DependentUpon>FrmMain.vb</DependentUpon>
<SubType>Form</SubType> <SubType>Form</SubType>
</Compile> </Compile>
<Compile Include="FrmNewTable.Designer.vb">
<DependentUpon>FrmNewTable.vb</DependentUpon>
</Compile>
<Compile Include="FrmNewTable.vb">
<SubType>Form</SubType>
</Compile>
<Compile Include="ModuleRuntimeVariables.vb" /> <Compile Include="ModuleRuntimeVariables.vb" />
<Compile Include="My Project\AssemblyInfo.vb" /> <Compile Include="My Project\AssemblyInfo.vb" />
<Compile Include="My Project\Application.Designer.vb"> <Compile Include="My Project\Application.Designer.vb">
@ -152,6 +155,9 @@
<EmbeddedResource Include="FrmMain.resx"> <EmbeddedResource Include="FrmMain.resx">
<DependentUpon>FrmMain.vb</DependentUpon> <DependentUpon>FrmMain.vb</DependentUpon>
</EmbeddedResource> </EmbeddedResource>
<EmbeddedResource Include="FrmNewTable.resx">
<DependentUpon>FrmNewTable.vb</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="My Project\licenses.licx" /> <EmbeddedResource Include="My Project\licenses.licx" />
<EmbeddedResource Include="My Project\Resources.resx"> <EmbeddedResource Include="My Project\Resources.resx">
<Generator>VbMyResourcesResXFileCodeGenerator</Generator> <Generator>VbMyResourcesResXFileCodeGenerator</Generator>
@ -188,6 +194,10 @@
<WCFMetadata Include="Connected Services\" /> <WCFMetadata Include="Connected Services\" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<ProjectReference Include="..\Modules.Database\Database.vbproj">
<Project>{eaf0ea75-5fa7-485d-89c7-b2d843b03a96}</Project>
<Name>Database</Name>
</ProjectReference>
<ProjectReference Include="..\Modules.Logging\Logging.vbproj"> <ProjectReference Include="..\Modules.Logging\Logging.vbproj">
<Project>{903b2d7d-3b80-4be9-8713-7447b704e1b0}</Project> <Project>{903b2d7d-3b80-4be9-8713-7447b704e1b0}</Project>
<Name>Logging</Name> <Name>Logging</Name>

View File

@ -45,6 +45,7 @@ Partial Class FrmConnection
Me.FbDatasourceTextBox.Name = "FbDatasourceTextBox" Me.FbDatasourceTextBox.Name = "FbDatasourceTextBox"
Me.FbDatasourceTextBox.Size = New System.Drawing.Size(227, 20) Me.FbDatasourceTextBox.Size = New System.Drawing.Size(227, 20)
Me.FbDatasourceTextBox.TabIndex = 2 Me.FbDatasourceTextBox.TabIndex = 2
Me.FbDatasourceTextBox.Text = "172.24.12.41"
' '
'FbDatabaseLocationTextBox 'FbDatabaseLocationTextBox
' '
@ -52,6 +53,7 @@ Partial Class FrmConnection
Me.FbDatabaseLocationTextBox.Name = "FbDatabaseLocationTextBox" Me.FbDatabaseLocationTextBox.Name = "FbDatabaseLocationTextBox"
Me.FbDatabaseLocationTextBox.Size = New System.Drawing.Size(682, 20) Me.FbDatabaseLocationTextBox.Size = New System.Drawing.Size(682, 20)
Me.FbDatabaseLocationTextBox.TabIndex = 1 Me.FbDatabaseLocationTextBox.TabIndex = 1
Me.FbDatabaseLocationTextBox.Text = "172.24.12.41:E:\DB\Firebird\Databases\DD_EDM.FDB"
' '
'FbUserTextBox 'FbUserTextBox
' '
@ -59,6 +61,7 @@ Partial Class FrmConnection
Me.FbUserTextBox.Name = "FbUserTextBox" Me.FbUserTextBox.Name = "FbUserTextBox"
Me.FbUserTextBox.Size = New System.Drawing.Size(140, 20) Me.FbUserTextBox.Size = New System.Drawing.Size(140, 20)
Me.FbUserTextBox.TabIndex = 3 Me.FbUserTextBox.TabIndex = 3
Me.FbUserTextBox.Text = "EDM_GUI"
' '
'FbPasswordTextBox 'FbPasswordTextBox
' '
@ -66,6 +69,7 @@ Partial Class FrmConnection
Me.FbPasswordTextBox.Name = "FbPasswordTextBox" Me.FbPasswordTextBox.Name = "FbPasswordTextBox"
Me.FbPasswordTextBox.Size = New System.Drawing.Size(86, 20) Me.FbPasswordTextBox.Size = New System.Drawing.Size(86, 20)
Me.FbPasswordTextBox.TabIndex = 4 Me.FbPasswordTextBox.TabIndex = 4
Me.FbPasswordTextBox.Text = "dd"
' '
'btnConnect 'btnConnect
' '

View File

@ -1,7 +1,13 @@
Imports Modules.Database Imports DigitalData.Modules.Database
Public Class FrmConnection Public Class FrmConnection
Public Property LogFactory As NLog.LogFactory
Private _logger As NLog.Logger
Private Sub FrmConnection_Load(sender As Object, e As EventArgs) Handles MyBase.Load Private Sub FrmConnection_Load(sender As Object, e As EventArgs) Handles MyBase.Load
_logger = LogFactory.GetCurrentClassLogger()
FbDatabaseLocationTextBox.DataBindings.Add("Text", My.Settings, "fbDatabaseLocation") FbDatabaseLocationTextBox.DataBindings.Add("Text", My.Settings, "fbDatabaseLocation")
FbDatasourceTextBox.DataBindings.Add("Text", My.Settings, "fbDatasource") FbDatasourceTextBox.DataBindings.Add("Text", My.Settings, "fbDatasource")
FbUserTextBox.DataBindings.Add("Text", My.Settings, "fbUser") FbUserTextBox.DataBindings.Add("Text", My.Settings, "fbUser")
@ -9,9 +15,10 @@ Public Class FrmConnection
End Sub End Sub
Private Sub BtnConnect_Click(sender As Object, e As EventArgs) Handles btnConnect.Click Private Sub BtnConnect_Click(sender As Object, e As EventArgs) Handles btnConnect.Click
My.Settings.Save() Dim dbTest As Firebird
Dim dbTest As New Firebird(My.Settings.fbDatasource, My.Settings.fbDatabaseLocation, My.Settings.fbUser, My.Settings.fbPassword) Try
dbTest = New Firebird(LogFactory, My.Settings.fbDatasource, My.Settings.fbDatabaseLocation, My.Settings.fbUser, My.Settings.fbPassword)
If dbTest.ConnectionFailed Then If dbTest.ConnectionFailed Then
MsgBox("Connection failed!", MsgBoxStyle.Information, "Database Connection") MsgBox("Connection failed!", MsgBoxStyle.Information, "Database Connection")
@ -21,6 +28,8 @@ Public Class FrmConnection
DialogResult = DialogResult.None DialogResult = DialogResult.None
Else Else
My.Settings.Save()
MsgBox("Connection successful!", MsgBoxStyle.Information, "Database Connection") MsgBox("Connection successful!", MsgBoxStyle.Information, "Database Connection")
lblConnectionStatus.Text = "Connection established!" lblConnectionStatus.Text = "Connection established!"
@ -28,5 +37,13 @@ Public Class FrmConnection
DialogResult = DialogResult.OK DialogResult = DialogResult.OK
End If End If
Catch ex As Exception
MsgBox("Connection failed!", MsgBoxStyle.Information, "Database Connection")
lblConnectionStatus.Text = "No connection established"
lblConnectionStatus.BackColor = Color.Red
DialogResult = DialogResult.None
End Try
End Sub End Sub
End Class End Class

View File

@ -1,16 +1,18 @@
Imports DigitalData.Modules.Database Imports DigitalData.Modules.Database
Imports DigitalData.Modules.Logging Imports DigitalData.Modules.Logging
Imports System.IO
Public Class FrmMain Public Class FrmMain
Private SelectedTable As Integer Private SelectedTable As Integer
Private Logger As NLog.Logger Private _logger As NLog.Logger
Private LogWrapper As LogConfig Private _logConfig As LogConfig
Private DBFirebird As Firebird Private DBFirebird As Firebird
Private Sub CreateTableNodesFromDatatable(dt As DataTable) Private Sub CreateTableNodesFromDatatable(dt As DataTable)
' Node der Datenbank erstellen ' Node der Datenbank erstellen
Dim dbNode As New TreeNode With { Dim dbNode As New TreeNode With {
.Text = My.Settings.fbDatabaseLocation .Text = My.Settings.fbDatabaseLocation,
.Name = "DATABASE"
} }
' Übernode für Tabellen erstellen ' Übernode für Tabellen erstellen
@ -48,7 +50,7 @@ Public Class FrmMain
End Function End Function
Private Sub Init() Private Sub Init()
DBFirebird = New Firebird(My.Settings.fbDatasource, My.Settings.fbDatabaseLocation, My.Settings.fbUser, My.Settings.fbPassword) DBFirebird = New Firebird(_logConfig.LogFactory, My.Settings.fbDatasource, My.Settings.fbDatabaseLocation, My.Settings.fbUser, My.Settings.fbPassword)
If DBFirebird.ConnectionFailed Then If DBFirebird.ConnectionFailed Then
MsgBox("Database connection failed. Please check the log.", vbCritical) MsgBox("Database connection failed. Please check the log.", vbCritical)
@ -56,39 +58,23 @@ Public Class FrmMain
End If End If
' Get info about the logged in user ' Get info about the logged in user
CurrentUser = New ClassCurrentUser(DBFirebird) 'CurrentUser = New ClassCurrentUser(DBFirebird)
Dim dt As DataTable = LoadTables() Dim dt As DataTable = LoadTables()
CreateTableNodesFromDatatable(dt) CreateTableNodesFromDatatable(dt)
End Sub End Sub
Private Sub FrmMain_Load(sender As Object, e As EventArgs) Handles Me.Load Private Sub FrmMain_Load(sender As Object, e As EventArgs) Handles Me.Load
LogWrapper = New LogConfig(ClassLogger.PathType.CurrentDirectory) _logConfig = New LogConfig(ClassLogger.PathType.CurrentDirectory)
_logger = _logConfig.LogFactory.GetCurrentClassLogger()
Logger = NLog.LogManager.GetCurrentClassLogger()
Logger.Debug("DEBUG1")
Logger.Debug("DEBUG2")
Logger.Debug("DEBUG3")
LogWrapper.Debug = False
Logger.Debug("DEBUG4")
Logger.Debug("DEBUG5")
Logger.Debug("DEBUG6")
LogWrapper.Debug = True
Logger.Debug("DEBUG7")
Logger.Debug("DEBUG8")
Logger.Debug("DEBUG9")
Logger.Info("Starting EDMDesigner..")
Logger.Error(New IO.FileNotFoundException("Central 66"), "This is Error!")
' Check for existing database credentials ' Check for existing database credentials
While Not DatabaseSettingsExist() While Not DatabaseSettingsExist()
Dim result As DialogResult = FrmConnection.ShowDialog() Dim form As New FrmConnection With {
.LogFactory = _logConfig.LogFactory
}
Dim result As DialogResult = form.ShowDialog()
If result = DialogResult.OK Then If result = DialogResult.OK Then
Exit While Exit While
End If End If
@ -129,20 +115,25 @@ Public Class FrmMain
End Sub End Sub
Private Sub DebugAnToolStripMenuItem_Click(sender As Object, e As EventArgs) Handles DebugAnToolStripMenuItem.Click Private Sub DebugAnToolStripMenuItem_Click(sender As Object, e As EventArgs) Handles DebugAnToolStripMenuItem.Click
LogWrapper.Debug = True _logConfig.Debug = True
End Sub End Sub
Private Sub DebugAusToolStripMenuItem_Click(sender As Object, e As EventArgs) Handles DebugAusToolStripMenuItem.Click Private Sub DebugAusToolStripMenuItem_Click(sender As Object, e As EventArgs) Handles DebugAusToolStripMenuItem.Click
LogWrapper.Debug = False _logConfig.Debug = False
End Sub End Sub
Private Sub WriteDebugLogToolStripMenuItem_Click(sender As Object, e As EventArgs) Handles WriteDebugLogToolStripMenuItem.Click Private Sub WriteDebugLogToolStripMenuItem_Click(sender As Object, e As EventArgs)
Logger.Debug("Welcome to monkey island!") _logger.Debug("Welcome to monkey island!")
End Sub End Sub
Private Sub SpamTheLogToolStripMenuItem_Click(sender As Object, e As EventArgs) Handles SpamTheLogToolStripMenuItem.Click Private Sub SpamTheLogToolStripMenuItem_Click(sender As Object, e As EventArgs)
For index = 1 To 100000 For index = 1 To 100000
Logger.Debug("Spam No. {0}", index) _logger.Debug("Spam No. {0}", index)
Next Next
End Sub End Sub
Private Sub NeueTabelleToolStripMenuItem_Click(sender As Object, e As EventArgs) Handles NeueTabelleToolStripMenuItem.Click
Dim frm As New FrmNewTable(_logConfig.LogFactory)
frm.ShowDialog()
End Sub
End Class End Class

73
EDMDesigner/FrmNewTable.Designer.vb generated Normal file
View File

@ -0,0 +1,73 @@
<Global.Microsoft.VisualBasic.CompilerServices.DesignerGenerated()> _
Partial Class FrmNewTable
Inherits System.Windows.Forms.Form
'Das Formular überschreibt den Löschvorgang, um die Komponentenliste zu bereinigen.
<System.Diagnostics.DebuggerNonUserCode()> _
Protected Overrides Sub Dispose(ByVal disposing As Boolean)
Try
If disposing AndAlso components IsNot Nothing Then
components.Dispose()
End If
Finally
MyBase.Dispose(disposing)
End Try
End Sub
'Wird vom Windows Form-Designer benötigt.
Private components As System.ComponentModel.IContainer
'Hinweis: Die folgende Prozedur ist für den Windows Form-Designer erforderlich.
'Das Bearbeiten ist mit dem Windows Form-Designer möglich.
'Das Bearbeiten mit dem Code-Editor ist nicht möglich.
<System.Diagnostics.DebuggerStepThrough()> _
Private Sub InitializeComponent()
Me.btnOK = New System.Windows.Forms.Button()
Me.TextBox1 = New System.Windows.Forms.TextBox()
Me.Label1 = New System.Windows.Forms.Label()
Me.SuspendLayout()
'
'btnOK
'
Me.btnOK.Location = New System.Drawing.Point(311, 51)
Me.btnOK.Name = "btnOK"
Me.btnOK.Size = New System.Drawing.Size(75, 23)
Me.btnOK.TabIndex = 0
Me.btnOK.Text = "OK"
Me.btnOK.UseVisualStyleBackColor = True
'
'TextBox1
'
Me.TextBox1.Location = New System.Drawing.Point(12, 25)
Me.TextBox1.Name = "TextBox1"
Me.TextBox1.Size = New System.Drawing.Size(374, 20)
Me.TextBox1.TabIndex = 1
'
'Label1
'
Me.Label1.AutoSize = True
Me.Label1.Location = New System.Drawing.Point(12, 9)
Me.Label1.Name = "Label1"
Me.Label1.Size = New System.Drawing.Size(77, 13)
Me.Label1.TabIndex = 2
Me.Label1.Text = "Tabellenname:"
'
'FrmNewTable
'
Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!)
Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font
Me.ClientSize = New System.Drawing.Size(398, 98)
Me.Controls.Add(Me.Label1)
Me.Controls.Add(Me.TextBox1)
Me.Controls.Add(Me.btnOK)
Me.Name = "FrmNewTable"
Me.Text = "Neue Tabelle"
Me.ResumeLayout(False)
Me.PerformLayout()
End Sub
Friend WithEvents btnOK As Button
Friend WithEvents TextBox1 As TextBox
Friend WithEvents Label1 As Label
End Class

View File

@ -0,0 +1,120 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>

View File

@ -0,0 +1,31 @@
Imports NLog
Imports DigitalData.Modules.Database
Public Class FrmNewTable
Private _logFactory As LogFactory
Private _logger As Logger
Private _db As Firebird
Public Sub New(LogFactory As LogFactory)
' Dieser Aufruf ist für den Designer erforderlich.
InitializeComponent()
' Fügen Sie Initialisierungen nach dem InitializeComponent()-Aufruf hinzu.
_logFactory = LogFactory
_logger = _logFactory.GetCurrentClassLogger()
End Sub
Private Sub FrmNewTable_Load(sender As Object, e As KeyEventArgs) Handles Me.Load
Try
_db = New Firebird(_logFactory, My.Settings.fbDatasource, My.Settings.fbDatabaseLocation, My.Settings.fbUser, My.Settings.fbPassword)
Catch ex As Exception
MsgBox("Connection to DB failed!", MsgBoxStyle.Critical)
_logger.Error(ex)
End Try
End Sub
Private Sub btnOK_Click(sender As Object, e As EventArgs) Handles btnOK.Click
End Sub
End Class

View File

@ -22,17 +22,16 @@ Partial Class FrmMain
'Das Bearbeiten mit dem Code-Editor ist nicht möglich. 'Das Bearbeiten mit dem Code-Editor ist nicht möglich.
<System.Diagnostics.DebuggerStepThrough()> <System.Diagnostics.DebuggerStepThrough()>
Private Sub InitializeComponent() Private Sub InitializeComponent()
Me.components = New System.ComponentModel.Container() Dim DockingContainer2 As DevExpress.XtraBars.Docking2010.Views.Tabbed.DockingContainer = New DevExpress.XtraBars.Docking2010.Views.Tabbed.DockingContainer()
Dim DockingContainer1 As DevExpress.XtraBars.Docking2010.Views.Tabbed.DockingContainer = New DevExpress.XtraBars.Docking2010.Views.Tabbed.DockingContainer() Me.DocumentGroup1 = New DevExpress.XtraBars.Docking2010.Views.Tabbed.DocumentGroup()
Me.DocumentGroup1 = New DevExpress.XtraBars.Docking2010.Views.Tabbed.DocumentGroup(Me.components) Me.Document1 = New DevExpress.XtraBars.Docking2010.Views.Tabbed.Document()
Me.Document1 = New DevExpress.XtraBars.Docking2010.Views.Tabbed.Document(Me.components)
Me.StatusStrip1 = New System.Windows.Forms.StatusStrip() Me.StatusStrip1 = New System.Windows.Forms.StatusStrip()
Me.ToolStripStatusLabelConState = New System.Windows.Forms.ToolStripStatusLabel() Me.ToolStripStatusLabelConState = New System.Windows.Forms.ToolStripStatusLabel()
Me.treeViewMain = New System.Windows.Forms.TreeView() Me.treeViewMain = New System.Windows.Forms.TreeView()
Me.gridControlTableProperties = New DevExpress.XtraGrid.GridControl() Me.gridControlTableProperties = New DevExpress.XtraGrid.GridControl()
Me.gridViewTableProperties = New DevExpress.XtraGrid.Views.Grid.GridView() Me.gridViewTableProperties = New DevExpress.XtraGrid.Views.Grid.GridView()
Me.MySettingsBindingSource = New System.Windows.Forms.BindingSource(Me.components) Me.MySettingsBindingSource = New System.Windows.Forms.BindingSource()
Me.contextMenuTable = New System.Windows.Forms.ContextMenuStrip(Me.components) Me.contextMenuTable = New System.Windows.Forms.ContextMenuStrip()
Me.TabelleBearbeitenToolStripMenuItem = New System.Windows.Forms.ToolStripMenuItem() Me.TabelleBearbeitenToolStripMenuItem = New System.Windows.Forms.ToolStripMenuItem()
Me.TabelleLöschenToolStripMenuItem = New System.Windows.Forms.ToolStripMenuItem() Me.TabelleLöschenToolStripMenuItem = New System.Windows.Forms.ToolStripMenuItem()
Me.ToolStripSeparator1 = New System.Windows.Forms.ToolStripSeparator() Me.ToolStripSeparator1 = New System.Windows.Forms.ToolStripSeparator()
@ -42,15 +41,15 @@ Partial Class FrmMain
Me.DebugToolStripMenuItem = New System.Windows.Forms.ToolStripMenuItem() Me.DebugToolStripMenuItem = New System.Windows.Forms.ToolStripMenuItem()
Me.DebugAnToolStripMenuItem = New System.Windows.Forms.ToolStripMenuItem() Me.DebugAnToolStripMenuItem = New System.Windows.Forms.ToolStripMenuItem()
Me.DebugAusToolStripMenuItem = New System.Windows.Forms.ToolStripMenuItem() Me.DebugAusToolStripMenuItem = New System.Windows.Forms.ToolStripMenuItem()
Me.WriteDebugLogToolStripMenuItem = New System.Windows.Forms.ToolStripMenuItem() Me.DockManager1 = New DevExpress.XtraBars.Docking.DockManager()
Me.DockManager1 = New DevExpress.XtraBars.Docking.DockManager(Me.components)
Me.DockPanel1 = New DevExpress.XtraBars.Docking.DockPanel() Me.DockPanel1 = New DevExpress.XtraBars.Docking.DockPanel()
Me.DockPanel1_Container = New DevExpress.XtraBars.Docking.ControlContainer() Me.DockPanel1_Container = New DevExpress.XtraBars.Docking.ControlContainer()
Me.DockPanel2 = New DevExpress.XtraBars.Docking.DockPanel() Me.DockPanel2 = New DevExpress.XtraBars.Docking.DockPanel()
Me.DockPanel2_Container = New DevExpress.XtraBars.Docking.ControlContainer() Me.DockPanel2_Container = New DevExpress.XtraBars.Docking.ControlContainer()
Me.DocumentManager1 = New DevExpress.XtraBars.Docking2010.DocumentManager(Me.components) Me.DocumentManager1 = New DevExpress.XtraBars.Docking2010.DocumentManager()
Me.TabbedView1 = New DevExpress.XtraBars.Docking2010.Views.Tabbed.TabbedView(Me.components) Me.TabbedView1 = New DevExpress.XtraBars.Docking2010.Views.Tabbed.TabbedView()
Me.SpamTheLogToolStripMenuItem = New System.Windows.Forms.ToolStripMenuItem() Me.contextMenuDatabase = New System.Windows.Forms.ContextMenuStrip()
Me.NeueTabelleToolStripMenuItem = New System.Windows.Forms.ToolStripMenuItem()
CType(Me.DocumentGroup1, System.ComponentModel.ISupportInitialize).BeginInit() CType(Me.DocumentGroup1, System.ComponentModel.ISupportInitialize).BeginInit()
CType(Me.Document1, System.ComponentModel.ISupportInitialize).BeginInit() CType(Me.Document1, System.ComponentModel.ISupportInitialize).BeginInit()
Me.StatusStrip1.SuspendLayout() Me.StatusStrip1.SuspendLayout()
@ -66,6 +65,7 @@ Partial Class FrmMain
Me.DockPanel2_Container.SuspendLayout() Me.DockPanel2_Container.SuspendLayout()
CType(Me.DocumentManager1, System.ComponentModel.ISupportInitialize).BeginInit() CType(Me.DocumentManager1, System.ComponentModel.ISupportInitialize).BeginInit()
CType(Me.TabbedView1, System.ComponentModel.ISupportInitialize).BeginInit() CType(Me.TabbedView1, System.ComponentModel.ISupportInitialize).BeginInit()
Me.contextMenuDatabase.SuspendLayout()
Me.SuspendLayout() Me.SuspendLayout()
' '
'DocumentGroup1 'DocumentGroup1
@ -162,7 +162,7 @@ Partial Class FrmMain
' '
'MenuStrip1 'MenuStrip1
' '
Me.MenuStrip1.Items.AddRange(New System.Windows.Forms.ToolStripItem() {Me.DebugToolStripMenuItem, Me.WriteDebugLogToolStripMenuItem, Me.SpamTheLogToolStripMenuItem}) Me.MenuStrip1.Items.AddRange(New System.Windows.Forms.ToolStripItem() {Me.DebugToolStripMenuItem})
Me.MenuStrip1.Location = New System.Drawing.Point(0, 0) Me.MenuStrip1.Location = New System.Drawing.Point(0, 0)
Me.MenuStrip1.Name = "MenuStrip1" Me.MenuStrip1.Name = "MenuStrip1"
Me.MenuStrip1.Size = New System.Drawing.Size(955, 24) Me.MenuStrip1.Size = New System.Drawing.Size(955, 24)
@ -188,12 +188,6 @@ Partial Class FrmMain
Me.DebugAusToolStripMenuItem.Size = New System.Drawing.Size(132, 22) Me.DebugAusToolStripMenuItem.Size = New System.Drawing.Size(132, 22)
Me.DebugAusToolStripMenuItem.Text = "Debug Aus" Me.DebugAusToolStripMenuItem.Text = "Debug Aus"
' '
'WriteDebugLogToolStripMenuItem
'
Me.WriteDebugLogToolStripMenuItem.Name = "WriteDebugLogToolStripMenuItem"
Me.WriteDebugLogToolStripMenuItem.Size = New System.Drawing.Size(108, 20)
Me.WriteDebugLogToolStripMenuItem.Text = "Write Debug Log"
'
'DockManager1 'DockManager1
' '
Me.DockManager1.Form = Me Me.DockManager1.Form = Me
@ -254,14 +248,20 @@ Partial Class FrmMain
' '
Me.TabbedView1.DocumentGroups.AddRange(New DevExpress.XtraBars.Docking2010.Views.Tabbed.DocumentGroup() {Me.DocumentGroup1}) Me.TabbedView1.DocumentGroups.AddRange(New DevExpress.XtraBars.Docking2010.Views.Tabbed.DocumentGroup() {Me.DocumentGroup1})
Me.TabbedView1.Documents.AddRange(New DevExpress.XtraBars.Docking2010.Views.BaseDocument() {Me.Document1}) Me.TabbedView1.Documents.AddRange(New DevExpress.XtraBars.Docking2010.Views.BaseDocument() {Me.Document1})
DockingContainer1.Element = Me.DocumentGroup1 DockingContainer2.Element = Me.DocumentGroup1
Me.TabbedView1.RootContainer.Nodes.AddRange(New DevExpress.XtraBars.Docking2010.Views.Tabbed.DockingContainer() {DockingContainer1}) Me.TabbedView1.RootContainer.Nodes.AddRange(New DevExpress.XtraBars.Docking2010.Views.Tabbed.DockingContainer() {DockingContainer2})
' '
'SpamTheLogToolStripMenuItem 'contextMenuDatabase
' '
Me.SpamTheLogToolStripMenuItem.Name = "SpamTheLogToolStripMenuItem" Me.contextMenuDatabase.Items.AddRange(New System.Windows.Forms.ToolStripItem() {Me.NeueTabelleToolStripMenuItem})
Me.SpamTheLogToolStripMenuItem.Size = New System.Drawing.Size(95, 20) Me.contextMenuDatabase.Name = "contextMenuDatabase"
Me.SpamTheLogToolStripMenuItem.Text = "Spam the Log!" Me.contextMenuDatabase.Size = New System.Drawing.Size(181, 48)
'
'NeueTabelleToolStripMenuItem
'
Me.NeueTabelleToolStripMenuItem.Name = "NeueTabelleToolStripMenuItem"
Me.NeueTabelleToolStripMenuItem.Size = New System.Drawing.Size(180, 22)
Me.NeueTabelleToolStripMenuItem.Text = "Neue Tabelle.."
' '
'FrmMain 'FrmMain
' '
@ -292,6 +292,7 @@ Partial Class FrmMain
Me.DockPanel2_Container.ResumeLayout(False) Me.DockPanel2_Container.ResumeLayout(False)
CType(Me.DocumentManager1, System.ComponentModel.ISupportInitialize).EndInit() CType(Me.DocumentManager1, System.ComponentModel.ISupportInitialize).EndInit()
CType(Me.TabbedView1, System.ComponentModel.ISupportInitialize).EndInit() CType(Me.TabbedView1, System.ComponentModel.ISupportInitialize).EndInit()
Me.contextMenuDatabase.ResumeLayout(False)
Me.ResumeLayout(False) Me.ResumeLayout(False)
Me.PerformLayout() Me.PerformLayout()
@ -322,6 +323,6 @@ Partial Class FrmMain
Friend WithEvents DebugToolStripMenuItem As ToolStripMenuItem Friend WithEvents DebugToolStripMenuItem As ToolStripMenuItem
Friend WithEvents DebugAnToolStripMenuItem As ToolStripMenuItem Friend WithEvents DebugAnToolStripMenuItem As ToolStripMenuItem
Friend WithEvents DebugAusToolStripMenuItem As ToolStripMenuItem Friend WithEvents DebugAusToolStripMenuItem As ToolStripMenuItem
Friend WithEvents WriteDebugLogToolStripMenuItem As ToolStripMenuItem Friend WithEvents contextMenuDatabase As ContextMenuStrip
Friend WithEvents SpamTheLogToolStripMenuItem As ToolStripMenuItem Friend WithEvents NeueTabelleToolStripMenuItem As ToolStripMenuItem
End Class End Class

View File

@ -135,4 +135,7 @@
<metadata name="DocumentManager1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"> <metadata name="DocumentManager1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>728, 17</value> <value>728, 17</value>
</metadata> </metadata>
<metadata name="contextMenuDatabase.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>892, 17</value>
</metadata>
</root> </root>

View File

@ -11,6 +11,8 @@
<FileAlignment>512</FileAlignment> <FileAlignment>512</FileAlignment>
<MyType>Windows</MyType> <MyType>Windows</MyType>
<TargetFrameworkVersion>v4.6.1</TargetFrameworkVersion> <TargetFrameworkVersion>v4.6.1</TargetFrameworkVersion>
<NuGetPackageImportStamp>
</NuGetPackageImportStamp>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols> <DebugSymbols>true</DebugSymbols>
@ -88,6 +90,7 @@
<Import Include="System.Threading.Tasks" /> <Import Include="System.Threading.Tasks" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<Compile Include="Exceptions.vb" />
<Compile Include="Firebird.vb" /> <Compile Include="Firebird.vb" />
<Compile Include="Oracle.vb" /> <Compile Include="Oracle.vb" />
<Compile Include="MSSQLServer.vb" /> <Compile Include="MSSQLServer.vb" />

View File

@ -0,0 +1,18 @@
Public Class Exceptions
Public Class DatabaseException
Inherits Exception
Public Sub New()
End Sub
Public Sub New(message As String)
MyBase.New(message)
End Sub
Public Sub New(message As String, innerException As Exception)
MyBase.New(message, innerException)
End Sub
End Class
End Class

View File

@ -1,55 +1,102 @@
Imports FirebirdSql.Data.FirebirdClient Imports NLog
Public Class Firebird Imports FirebirdSql.Data.FirebirdClient
Private Shared Logger As NLog.Logger = NLog.LogManager.GetCurrentClassLogger
Public DBInitialized As Boolean = False
Private _connectionEstablished As Boolean = False
Private _connectionFailed As Boolean = False
Private ReadOnly dataSource As String
Private ReadOnly database As String
Private ReadOnly user As String
Private ReadOnly password As String
Public CurrentFBDConnectionString As String = ""
Public ReadOnly Property ConnectionString As String
Public ReadOnly Property ConnectionEstablished As Boolean
Get
Return _connectionEstablished
End Get
End Property
''' <summary>
''' MODULE: Firebird
'''
''' VERSION: 0.0.0.1
'''
''' DATE: 03.09.2018
'''
''' DESCRIPTION:
'''
''' DEPENDENCIES: NLog, >= 4.5.8
'''
''' EntityFramework.Firebird, >= 6.1.0
'''
''' FirebirdSql.Data.FirebirdClient, >= 6.0.0
'''
''' PARAMETERS: LogFactory, NLog.LogFactory
''' The LogFactory containing the current log config. Used to instanciate the class logger for this and any dependent class
'''
''' DataSource, String
''' The location of the Database in the format `127.0.0.1:E:\Path\To\Database.FDB`
'''
''' Database, String
''' The server where the database lives, for example 127.0.0.1 or dd-vmx09-vm03
'''
''' User, String
''' The user name to connect as
'''
''' Password, String
''' The user's password
'''
''' PROPERTIES: ConnectionEstablished, Boolean
''' If the last opened connection was successful
'''
''' ConnectionFailed, Boolean
''' If the last opened connection failed
'''
''' ConnectionString, String
''' The used connectionstring
'''
''' EXAMPLES:
'''
''' REMARKS: If the connection fails due to "wrong username or password", the cause might be that the server harddrive is full..
''' </summary>
Public Class Firebird
Private _logger As Logger
Private _connectionServer As String
Private _connectionDatabase As String
Private _connectionUsername As String
Private _connectionPassword As String
Public ReadOnly Property ConnectionEstablished As Boolean
Public ReadOnly Property ConnectionFailed As Boolean Public ReadOnly Property ConnectionFailed As Boolean
Get Public ReadOnly Property ConnectionString As String
Return _connectionFailed
End Get ''' <summary>
End Property '''
Public Sub New(dataSource As String, database As String, user As String, password As String) ''' </summary>
ConnectionString = BuildConnectionString(dataSource, database, user, password) ''' <param name="LogFactory"></param>
' Save connection credentials ''' <param name="Datasource"></param>
dataSource = dataSource ''' <param name="Database"></param>
database = database ''' <param name="User"></param>
user = user ''' <param name="Password"></param>
password = password ''' <exception cref="Exceptions.DatabaseException"></exception>
Public Sub New(LogFactory As LogFactory, Datasource As String, Database As String, User As String, Password As String)
_logger = LogFactory.GetCurrentClassLogger()
' Test the connection first ' Test the connection first
Dim conn = Connect(ConnectionString) Dim oConnectionString = GetConnectionString(Datasource, Database, User, Password)
Dim oConnection = GetConnection(oConnectionString)
' If initial connection was successfully, close it ' If initial connection was successfully, close it
conn?.Close() oConnection?.Close()
If oConnection Is Nothing Then
Throw New Exceptions.DatabaseException()
End If
_connectionServer = Datasource
_connectionDatabase = Database
_connectionUsername = User
_connectionPassword = Password
_ConnectionString = oConnectionString
End Sub End Sub
Private Function Connect(ConnectionString As String) As FbConnection Private Function GetConnection(ConnectionString As String) As FbConnection
Try Try
Dim conn = New FbConnection(ConnectionString) Dim oConnection = New FbConnection(ConnectionString)
conn.Open() oConnection.Open()
_connectionEstablished = True _ConnectionEstablished = True
_connectionFailed = False _ConnectionFailed = False
Logger.Debug("Connection established!")
Logger.Debug($"User: {user}")
Logger.Debug($"DatabaseLocation: {database}")
Logger.Debug($"DatabaseServer: {dataSource}")
Return conn Return oConnection
Catch ex As Exception Catch ex As Exception
_connectionFailed = True _ConnectionFailed = True
_connectionEstablished = False _ConnectionEstablished = False
Logger.Error(ex) _logger.Error(ex)
Return Nothing Return Nothing
End Try End Try
@ -58,48 +105,46 @@ Public Class Firebird
''' <summary> ''' <summary>
''' Builds a connectionstring from the provided arguments. ''' Builds a connectionstring from the provided arguments.
''' </summary> ''' </summary>
''' <param name="dataSource">The database server where to connect to</param> ''' <param name="DataSource">The database server where to connect to</param>
''' <param name="database">The datasource, eg. the path of the FDB-file</param> ''' <param name="Database">The datasource, eg. the path of the FDB-file</param>
''' <param name="user">The user used to connect to the database</param> ''' <param name="User">The user used to connect to the database</param>
''' <param name="password">The password of the connecting user</param> ''' <param name="Password">The password of the connecting user</param>
''' <returns>A connectionstring</returns> ''' <returns>A connectionstring</returns>
Private Function BuildConnectionString(dataSource As String, database As String, user As String, password As String) As String Private Function GetConnectionString(DataSource As String, Database As String, User As String, Password As String) As String
Dim connectionStringBuilder = New FbConnectionStringBuilder With { Return New FbConnectionStringBuilder With {
.DataSource = dataSource, .DataSource = DataSource,
.Database = database, .Database = Database,
.UserID = user, .UserID = User,
.Password = password .Password = Password
} }.ToString()
Return connectionStringBuilder.ConnectionString
End Function End Function
''' <summary> ''' <summary>
''' Executes a non-query command. ''' Executes a non-query command.
''' </summary> ''' </summary>
''' <param name="sqlCommand">The command to execute</param> ''' <param name="SqlCommand">The command to execute</param>
''' <returns>True, if command was executed sucessfully. Otherwise false.</returns> ''' <returns>True, if command was executed sucessfully. Otherwise false.</returns>
Public Function NewExecuteNonQuery(sqlCommand As String) As Boolean Public Function ExecuteNonQuery(SqlCommand As String) As Boolean
Try Try
Dim conn As FbConnection = Connect(ConnectionString) Dim oConnection As FbConnection = GetConnection(ConnectionString)
If conn Is Nothing Then If oConnection Is Nothing Then
Return False Return False
End If End If
Dim transaction As FbTransaction = conn.BeginTransaction() Dim oTransaction As FbTransaction = oConnection.BeginTransaction()
Dim command As New FbCommand With { Dim oCommand As New FbCommand With {
.CommandText = sqlCommand, .CommandText = SqlCommand,
.Connection = conn, .Connection = oConnection,
.Transaction = transaction .Transaction = oTransaction
} }
command.ExecuteNonQuery() oCommand.ExecuteNonQuery()
oTransaction.Commit()
transaction.Commit() oConnection.Close()
conn.Close()
Return True Return True
Catch ex As Exception Catch ex As Exception
Logger.Error(ex, $"Error in ExecuteNonQuery while executing command: '{sqlCommand}'") _logger.Error(ex, $"Error in ExecuteNonQuery while executing command: '{SqlCommand}'")
Return False Return False
End Try End Try
End Function End Function
@ -107,30 +152,30 @@ Public Class Firebird
''' <summary> ''' <summary>
''' Executes a sql query resulting in a scalar value. ''' Executes a sql query resulting in a scalar value.
''' </summary> ''' </summary>
''' <param name="sqlQuery">The query to execute</param> ''' <param name="SqlQuery">The query to execute</param>
''' <returns>The scalar value if the command was executed successfully. Nothing otherwise.</returns> ''' <returns>The scalar value if the command was executed successfully. Nothing otherwise.</returns>
Public Function GetExecuteScalar(sqlQuery As String) As Object Public Function GetScalarValue(SqlQuery As String) As Object
Try Try
Dim conn As FbConnection = Connect(ConnectionString) Dim oConnection As FbConnection = GetConnection(ConnectionString)
If conn Is Nothing Then If oConnection Is Nothing Then
Return Nothing Return Nothing
End If End If
Dim transaction As FbTransaction = conn.BeginTransaction() Dim oTransaction As FbTransaction = oConnection.BeginTransaction()
Dim command As New FbCommand With { Dim oCommand As New FbCommand With {
.CommandText = sqlQuery, .CommandText = SqlQuery,
.Connection = conn, .Connection = oConnection,
.Transaction = transaction .Transaction = oTransaction
} }
Dim result As Object = command.ExecuteScalar() Dim oResult As Object = oCommand.ExecuteScalar()
transaction.Commit() oTransaction.Commit()
conn.Close() oConnection.Close()
Return result Return oResult
Catch ex As Exception Catch ex As Exception
Logger.Error(ex, $"Error in ReturnScalar while executing command: '{sqlQuery}'") _logger.Error(ex, $"Error in ReturnScalar while executing command: '{SqlQuery}'")
Return Nothing Return Nothing
End Try End Try
End Function End Function
@ -138,29 +183,29 @@ Public Class Firebird
''' <summary> ''' <summary>
''' Executes a sql query resulting in a table of values. ''' Executes a sql query resulting in a table of values.
''' </summary> ''' </summary>
''' <param name="sqlQuery">The query to execute</param> ''' <param name="SqlQuery">The query to execute</param>
''' <returns>A datatable containing the results if the command was executed successfully. Nothing otherwise.</returns> ''' <returns>A datatable containing the results if the command was executed successfully. Nothing otherwise.</returns>
Public Function GetDatatable(sqlQuery As String) As DataTable Public Function GetDatatable(SqlQuery As String) As DataTable
Try Try
Dim conn As FbConnection = Connect(ConnectionString) Dim oConnection As FbConnection = GetConnection(ConnectionString)
If conn Is Nothing Then If oConnection Is Nothing Then
Return Nothing Return Nothing
End If End If
Dim command As New FbCommand With { Dim oCommand As New FbCommand With {
.CommandText = sqlQuery, .CommandText = SqlQuery,
.Connection = conn .Connection = oConnection
} }
Dim adapter As New FbDataAdapter(command) Dim oAdapter As New FbDataAdapter(oCommand)
Dim dt As New DataTable() Dim oDatatable As New DataTable()
adapter.Fill(dt) oAdapter.Fill(oDatatable)
conn.Close() oConnection.Close()
Return dt Return oDatatable
Catch ex As Exception Catch ex As Exception
Logger.Error(ex, $"Error in ReturnDatatable while executing command: '{sqlQuery}'") _logger.Error(ex, $"Error in ReturnDatatable while executing command: '{SqlQuery}'")
Return Nothing Return Nothing
End Try End Try
End Function End Function