MS SQL Designer
This commit is contained in:
@@ -1,4 +1,6 @@
|
||||
Imports DigitalData.Modules.Database
|
||||
Imports DevExpress.XtraEditors
|
||||
Imports DevExpress.XtraEditors.Repository
|
||||
Imports DigitalData.Modules.Database
|
||||
|
||||
Public Class frmSQLDesigner
|
||||
Dim CurrentPosition As Integer = 0
|
||||
@@ -23,10 +25,16 @@ Public Class frmSQLDesigner
|
||||
Public Property ConnectionID
|
||||
Public AutoAttributID
|
||||
Public Property DesignType As String
|
||||
Private IndicesMan As New List(Of Indice_Man)()
|
||||
Public Class Indice_Man
|
||||
Public Property ID() As Integer
|
||||
Public Property Indice_name() As String
|
||||
|
||||
End Class
|
||||
|
||||
Private Sub frmSQLDesigner_Load(sender As Object, e As EventArgs) Handles Me.Load
|
||||
Dim oSQL
|
||||
lblSaveFinalIndex.Visible = False
|
||||
bsiInfo.Visibility = DevExpress.XtraBars.BarItemVisibility.Never
|
||||
|
||||
If DesignType = "GI_ATTRIBUTE_MAN" Then
|
||||
EnDisable_Man_Attribute(False)
|
||||
@@ -49,11 +57,31 @@ Public Class frmSQLDesigner
|
||||
'btnShowConnections.Enabled = False
|
||||
Else
|
||||
cmbConnection.Enabled = True
|
||||
oSQL = "SELECT * FROM TBDD_CONNECTION WHERE AKTIV = 1"
|
||||
oSQL = "SELECT GUID, Bezeichnung FROM TBDD_CONNECTION WHERE AKTIV = 1"
|
||||
Dim oDT As DataTable = My.DatabaseECM.GetDatatable(oSQL)
|
||||
cmbConnection.DataSource = oDT
|
||||
cmbConnection.DisplayMember = oDT.Columns("Bezeichnung").ColumnName
|
||||
cmbConnection.ValueMember = oDT.Columns("GUID").ColumnName
|
||||
|
||||
|
||||
IndicesMan.Add(New Indice_Man() With {.ID = 1, .Indice_name = "Manually"})
|
||||
|
||||
'bind the lookup editor to the list
|
||||
Dim oLU As RepositoryItemLookUpEdit = RepositoryItemLookUpEdit3
|
||||
oLU.DataSource = oDT
|
||||
|
||||
oLU.DisplayMember = oDT.Columns("Bezeichnung").ColumnName
|
||||
oLU.ValueMember = oDT.Columns("GUID").ColumnName
|
||||
' Enable the "best-fit" functionality mode in which columns have proportional widths and the popup window is resized to fit all the columns.
|
||||
oLU.BestFitMode = DevExpress.XtraEditors.Controls.BestFitMode.BestFitResizePopup
|
||||
' Specify the dropdown height.
|
||||
oLU.DropDownRows = oDT.Rows.Count
|
||||
|
||||
' Enable the automatic completion feature. In this mode, when the dropdown is closed,
|
||||
' the text in the edit box is automatically completed if it matches a DisplayMember field value of one of dropdown rows.
|
||||
oLU.SearchMode = DevExpress.XtraEditors.Controls.SearchMode.AutoComplete
|
||||
' Specify the column against which an incremental search is performed in SearchMode.AutoComplete and SearchMode.OnlyInPopup modes
|
||||
oLU.AutoSearchColumnIndex = 1
|
||||
If Not IsNothing(ConnectionID) Then
|
||||
If IsNumeric(ConnectionID) Then
|
||||
cmbConnection.SelectedValue = ConnectionID
|
||||
@@ -111,46 +139,6 @@ Public Class frmSQLDesigner
|
||||
SQL_COMMANDTextBox.SelectionStart = altePosition + str.Length
|
||||
End Sub
|
||||
|
||||
Private Sub btnTestSQL_Click(sender As Object, e As EventArgs) Handles btnTestSQL.Click
|
||||
Try
|
||||
Dim query As String = SQL_COMMANDTextBox.Text
|
||||
|
||||
For Each row As DataGridViewRow In dgvPlaceholders.Rows
|
||||
Dim placeholder As String = row.Cells(0).Value
|
||||
Dim replacement As String = row.Cells(1).Value
|
||||
|
||||
' Wenn Ersetzung ausgefüllt wurde, Platzhalter damit ersetzen
|
||||
If Not String.IsNullOrEmpty(replacement) Then
|
||||
Dim pattern As New clsPatterns.Pattern(placeholder)
|
||||
|
||||
query = clsPatterns.ReplacePattern(query, pattern.Type, replacement)
|
||||
Else
|
||||
MsgBox("Bitte geben Sie für den Platzhalter " & placeholder & " einen Wert an!", MsgBoxStyle.Exclamation, "Fehlende Platzhalter Ersetzung")
|
||||
Exit Sub
|
||||
End If
|
||||
Next
|
||||
MsgBox(cmbConnection.SelectedValue)
|
||||
Dim oconString = My.DatabaseECM.Get_ConnectionStringforID(cmbConnection.SelectedValue)
|
||||
MsgBox(oconString)
|
||||
Dim decryptedConString = MSSQLServer.DecryptConnectionString(oconString)
|
||||
MsgBox(decryptedConString)
|
||||
Dim oDT = My.DatabaseECM.GetDatatableWithConnection(query, decryptedConString)
|
||||
|
||||
|
||||
If oDT IsNot Nothing Then
|
||||
dgvResult.DataSource = oDT
|
||||
End If
|
||||
Catch ex As Exception
|
||||
MsgBox(ex.Message, MsgBoxStyle.Critical)
|
||||
End Try
|
||||
|
||||
End Sub
|
||||
|
||||
Private Sub SimpleButton1_Click(sender As Object, e As EventArgs) Handles SimpleButton1.Click
|
||||
SQLCommand = SQL_COMMANDTextBox.Text
|
||||
ConnectionID = cmbConnection.SelectedValue
|
||||
Me.Close()
|
||||
End Sub
|
||||
|
||||
Private Sub btnAddAttributeMan_Click(sender As Object, e As EventArgs) Handles btnAddAttributeMan.Click
|
||||
If cmbAttributeMan.SelectedIndex <> -1 Then
|
||||
@@ -172,4 +160,49 @@ Public Class frmSQLDesigner
|
||||
InsertAtSelection(value)
|
||||
End If
|
||||
End Sub
|
||||
|
||||
Private Sub BarButtonItem1_ItemClick(sender As Object, e As DevExpress.XtraBars.ItemClickEventArgs) Handles BarButtonItem1.ItemClick
|
||||
Try
|
||||
Dim query As String = SQL_COMMANDTextBox.Text
|
||||
|
||||
For Each row As DataGridViewRow In dgvPlaceholders.Rows
|
||||
Dim placeholder As String = row.Cells(0).Value
|
||||
Dim replacement As String = row.Cells(1).Value
|
||||
|
||||
' Wenn Ersetzung ausgefüllt wurde, Platzhalter damit ersetzen
|
||||
If Not String.IsNullOrEmpty(replacement) Then
|
||||
Dim pattern As New clsPatterns.Pattern(placeholder)
|
||||
|
||||
query = clsPatterns.ReplacePattern(query, pattern.Type, replacement)
|
||||
Else
|
||||
MsgBox("Bitte geben Sie für den Platzhalter " & placeholder & " einen Wert an!", MsgBoxStyle.Exclamation, "Fehlende Platzhalter Ersetzung")
|
||||
Exit Sub
|
||||
End If
|
||||
Next
|
||||
'MsgBox(cmbConnection.SelectedValue)
|
||||
Dim oconString = My.DatabaseECM.Get_ConnectionStringforID(cmbConnection.SelectedValue)
|
||||
'MsgBox(oconString)
|
||||
Dim decryptedConString = MSSQLServer.DecryptConnectionString(oconString)
|
||||
'MsgBox(decryptedConString)
|
||||
Dim oDT = My.DatabaseECM.GetDatatableWithConnection(query, decryptedConString)
|
||||
|
||||
|
||||
If oDT IsNot Nothing Then
|
||||
GridControl1.DataSource = Nothing
|
||||
GridControl1.DataSource = oDT
|
||||
End If
|
||||
Catch ex As Exception
|
||||
MsgBox(ex.Message, MsgBoxStyle.Critical)
|
||||
End Try
|
||||
End Sub
|
||||
|
||||
Private Sub BarButtonItem2_ItemClick(sender As Object, e As DevExpress.XtraBars.ItemClickEventArgs) Handles BarButtonItem2.ItemClick
|
||||
SQLCommand = SQL_COMMANDTextBox.Text
|
||||
ConnectionID = cmbConnection.SelectedValue
|
||||
Me.Close()
|
||||
End Sub
|
||||
|
||||
Private Sub Label2_Click(sender As Object, e As EventArgs) Handles Label2.Click
|
||||
|
||||
End Sub
|
||||
End Class
|
||||
Reference in New Issue
Block a user