vbscript 它只是弹出对话框,允许您指定数据库文本文件和连接字符串/表名的文件路径。

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了vbscript 它只是弹出对话框,允许您指定数据库文本文件和连接字符串/表名的文件路径。相关的知识,希望对你有一定的参考价值。

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

以上是关于vbscript 它只是弹出对话框,允许您指定数据库文本文件和连接字符串/表名的文件路径。的主要内容,如果未能解决你的问题,请参考以下文章

ASP执行到某一行代码的时候弹出一个对话框,点“是”则继续往下执行,点“否”则不往下执行,如何做?

pycharm不停地弹出激活框

如何使用EditText字段创建简单的Android studio弹出窗口以进行数据插入

在 Access 中探索文件

简单的快速颜色选择器弹出框(iOS)

停止运行VBScript