Skip to content

Commit c851393

Browse files
committed
Added environment changing possibility to DBSheetCreateForm
Fixes to problems in DBConnHelper/password in DBSheet connection string Documentation update
1 parent 78c04f6 commit c851393

17 files changed

+103
-40
lines changed

Distribution/DBaddin32.xll

512 Bytes
Binary file not shown.

Distribution/DBaddin64.xll

512 Bytes
Binary file not shown.

docs/DBSheets.md

+53-23
Large diffs are not rendered by default.

docs/image/DBSheetsDefBlank.PNG

1.18 KB
Loading
2.38 KB
Loading
-456 Bytes
Loading
-577 Bytes
Loading

docs/image/DBSheetsDefLookupList.PNG

363 Bytes
Loading
250 Bytes
Loading
3.87 KB
Loading
5.99 KB
Loading
1.87 KB
Loading
370 Bytes
Loading

source/DBConnHelper.vb

+5-5
Original file line numberDiff line numberDiff line change
@@ -24,17 +24,17 @@ Public Class DBConnHelper
2424
DBenv = passedEnv
2525
setConnectionString()
2626
dbGetAllStr = fetchSetting("dbGetAll" + DBenv, "NONEXISTENT")
27-
If dbGetAllStr = "NONEXISTENT" Then
27+
If dbGetAllStr = "NONEXISTENT" Or dbGetAllStr = "" Then
2828
UserMsg("No dbGetAllStr given for environment: " + DBenv + ", please correct and rerun.", "DBSheet Definition Error")
2929
Exit Sub
3030
End If
3131
DBGetAllFieldName = fetchSetting("dbGetAllFieldName" + DBenv, "NONEXISTENT")
32-
If DBGetAllFieldName = "NONEXISTENT" Then
32+
If DBGetAllFieldName = "NONEXISTENT" Or DBGetAllFieldName = "" Then
3333
UserMsg("No DBGetAllFieldName given for environment: " + DBenv + ", please correct and rerun.", "DBSheet Definition Error")
3434
Exit Sub
3535
End If
3636
dbidentifier = fetchSetting("DBidentifierCCS" + DBenv, "NONEXISTENT")
37-
If dbidentifier = "NONEXISTENT" Then
37+
If dbidentifier = "NONEXISTENT" Or dbidentifier = "" Then
3838
UserMsg("No DB identifier given for environment: " + DBenv + ", please correct and rerun.", "DBSheet Definition Error")
3939
Exit Sub
4040
End If
@@ -123,10 +123,10 @@ Public Class DBConnHelper
123123
Private Sub setConnectionString()
124124
' do we have a separate dbsheet connection string?
125125
dbsheetConnString = fetchSetting("DBSheetConnString" + DBenv, "NONEXISTENT")
126-
If dbsheetConnString = "NONEXISTENT" Then
126+
If dbsheetConnString = "NONEXISTENT" Or dbsheetConnString = "" Then
127127
' no, try normal connection string
128128
dbsheetConnString = fetchSetting("ConstConnString" + DBenv, "NONEXISTENT")
129-
If dbsheetConnString = "NONEXISTENT" Then
129+
If dbsheetConnString = "NONEXISTENT" Or dbsheetConnString = "" Then
130130
' actually this cannot happen....
131131
UserMsg("No connection string given for environment: " + DBenv + ", please correct and rerun.", "DBSheet Definition Error")
132132
Exit Sub

source/DBSheetCreateForm.Designer.vb

+16-2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

source/DBSheetCreateForm.vb

+27-8
Original file line numberDiff line numberDiff line change
@@ -23,11 +23,6 @@ Public Class DBSheetCreateForm
2323
''' <param name="sender"></param>
2424
''' <param name="e"></param>
2525
Private Sub DBSheetCreateForm_Shown(sender As Object, e As EventArgs) Handles Me.Shown
26-
' get settings for DBSheet definition editing
27-
myDBConnHelper = New DBConnHelper(env())
28-
tblPlaceHolder = fetchSetting("tblPlaceHolder" + env(), "!T!")
29-
specialNonNullableChar = fetchSetting("specialNonNullableChar" + env(), "*")
30-
Lenvironment.Text = "Environment: " + fetchSetting("ConfigName" + env(), "")
3126

3227
' set up columns for DBSheetCols grid-view
3328
Dim nameCB As New DataGridViewComboBoxColumn With {
@@ -92,6 +87,18 @@ Public Class DBSheetCreateForm
9287
}
9388
DBSheetCols.AutoGenerateColumns = False
9489
DBSheetCols.Columns.AddRange(nameCB, ftableCB, fkeyCB, flookupCB, outerCB, primkeyCB, typeTB, sortCB, lookupTB)
90+
finalizeSetup()
91+
End Sub
92+
93+
Private Sub finalizeSetup()
94+
' get settings for DBSheet definition editing
95+
myDBConnHelper = New DBConnHelper(env())
96+
tblPlaceHolder = fetchSetting("tblPlaceHolder" + env(), "!T!")
97+
specialNonNullableChar = fetchSetting("specialNonNullableChar" + env(), "*")
98+
FormDisabled = True
99+
Me.Environment.DataSource = environdefs
100+
Me.Environment.Text = environdefs(env(True))
101+
FormDisabled = False
95102
DBSheetColsEditable(False)
96103

97104
' if we have a Password to enter (dbPwdSpec contained in dbsheetConnString and no password entered yet), just display explanation text in title bar and let user enter password...
@@ -101,6 +108,7 @@ Public Class DBSheetCreateForm
101108
assignDBSheet.Enabled = False
102109
' password-less connection string, reset password and disable...
103110
If InStr(myDBConnHelper.dbsheetConnString, myDBConnHelper.dbPwdSpec) = 0 Or myDBConnHelper.dbPwdSpec = "" Then
111+
If InStr(myDBConnHelper.dbsheetConnString, myDBConnHelper.dbPwdSpec) = 0 Then UserMsg("The DB specific password string (" + myDBConnHelper.dbPwdSpec + ") is not contained in connection string:" + myDBConnHelper.dbsheetConnString + ", therefore no password entry is possible")
104112
Password.Enabled = False
105113
existingPwd = ""
106114
Else ' set to stored existing password
@@ -111,6 +119,7 @@ Public Class DBSheetCreateForm
111119
End If
112120
End Sub
113121

122+
114123
Private Sub resetDBSheetCreateForm()
115124
Me.Text = "DB Sheet creation: Please enter required Password into Field Pwd to access schema information"
116125
TableEditable(False)
@@ -1142,23 +1151,26 @@ Public Class DBSheetCreateForm
11421151
End Try
11431152
End Function
11441153

1145-
''' <summary>current file link clicked: open possibility</summary>
1154+
''' <summary>current file link clicked: open file using default editor</summary>
11461155
''' <param name="sender"></param>
11471156
''' <param name="e"></param>
1148-
Private Sub CurrentFileLinkLabel_Click(sender As Object, e As EventArgs) Handles CurrentFileLinkLabel.Click
1157+
Private Sub CurrentFileLinkLabel_LinkClicked(sender As Object, e As LinkLabelLinkClickedEventArgs) Handles CurrentFileLinkLabel.LinkClicked
11491158
' CurrentFileLinkLabel.Tag contains the path to the current file
11501159
Diagnostics.Process.Start(CurrentFileLinkLabel.Tag)
11511160
End Sub
1161+
11521162
#End Region
11531163

11541164
#Region "GUI Helper functions"
1155-
''' <summary>Table/Database/Password change possible</summary>
1165+
''' <summary>Environment/Table/Database/Password change possible</summary>
11561166
''' <param name="choice">possible True, not possible False</param>
11571167
Private Sub TableEditable(choice As Boolean)
11581168
Database.Enabled = choice
11591169
LDatabase.Enabled = choice
11601170
Table.Enabled = choice
11611171
LTable.Enabled = choice
1172+
Environment.Enabled = choice
1173+
Lenvironment.Enabled = choice
11621174
End Sub
11631175

11641176
''' <summary>if DBSheetCols Definitions should be editable, enable relevant controls</summary>
@@ -1238,6 +1250,13 @@ Public Class DBSheetCreateForm
12381250
assignDBSheet.Enabled = False
12391251
End Sub
12401252

1253+
Private Sub Environment_SelectedIndexChanged(sender As Object, e As EventArgs) Handles Environment.SelectedIndexChanged
1254+
If FormDisabled Then Exit Sub
1255+
SettingsTools.selectedEnvironment = Me.Environment.SelectedIndex
1256+
theRibbon.InvalidateControl("envDropDown")
1257+
finalizeSetup()
1258+
End Sub
1259+
12411260
#End Region
12421261
End Class
12431262

source/My Project/AssemblyInfo.vb

+2-2
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,6 @@ Imports System.Runtime.InteropServices
3131
' You can specify all the values or you can default the Build and Revision Numbers
3232
' by using the '*' as shown below:
3333

34-
<Assembly: AssemblyVersion("1.0.0.72")>
35-
<Assembly: AssemblyFileVersion("1.0.0.72")>
34+
<Assembly: AssemblyVersion("1.0.0.73")>
35+
<Assembly: AssemblyFileVersion("1.0.0.73")>
3636
<Assembly: NeutralResourcesLanguage("de-DE")>

0 commit comments

Comments
 (0)