Private Sub ValidationForm_ButtonClicked(ByVal ButtonName As String, ByVal pXDoc As CASCADELib.CscXDocument)
Dim oDb As CscDatabase
Dim lCount As Long
For lCount = 0 To Project.Databases.Count -1
Set oDb = Project.Databases.ItemByIndex(lCount)
UpdateDbDetails oDb
Next
End Sub
Private Sub UpdateDbDetails(oDb As CscDatabase )
Dim strOutput As String
Dim strResult As String
Dim FSO As Object
Dim strFileName As String
Dim strDirPath As String
If oDb.DatabaseType = 0 Then
strOutput = "Database Name: " & oDb.Name & vbCrLf & _
"Database Type: " & GetDbTypeFriendlyName(oDb.DatabaseType) & vbCrLf
'strResult = InputBox(strOutput, "Specify DB File Path", oDb.ImportFilename)
Set FSO = CreateObject("Scripting.FileSystemObject")
strDirPath = FSO.GetParentFolderName(oDb.ImportFilename)
strFileName = FSO.GetFileName(oDb.ImportFilename)
strResult = GetFilePath(strFileName, "Text Files|*.txt|All Files|*", strDirPath, "Specify DB File Path for " & oDb.Name, 0)
If strResult <> "" Then
oDb.ImportFilename = strResult
oDb.ImportDatabase True
End If
Else
strOutput = "Database Name: " & oDb.Name & vbCrLf & _
"Database Type: " & GetDbTypeFriendlyName(oDb.DatabaseType) & vbCrLf
strResult = InputBox(strOutput, "Specify New DB Connection String", oDb.SQLTable.ConnectionString)
If strResult <> "" And oDb.SQLTable.ConnectionString <> strResult Then
oDb.SQLTable.ConnectionString = strResult
End If
strResult = InputBox(strOutput, "Specify New DB Table Name", oDb.SQLTable.TableName)
If strResult <> "" And oDb.SQLTable.TableName <> strResult Then
oDb.SQLTable.TableName = strResult
End If
End If
End Sub
Private Function GetDbTypeFriendlyName(lDbType As Long) As String
Select Case lDbType
Case 0:
GetDbTypeFriendlyName = "Local DB"
Case 1:
GetDbTypeFriendlyName = "Relational DB"
Case 2:
GetDbTypeFriendlyName = "Remote DB"
Case Else:
GetDbTypeFriendlyName = "Unsupported DB"
End Select
End Function